Closed Bug 246385 Opened 21 years ago Closed 21 years ago

on click event on image not working

Categories

(SeaMonkey :: General, defect)

x86
Windows 2000
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INVALID

People

(Reporter: mozilla, Unassigned)

References

Details

Attachments

(2 files)

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7) Gecko/20040608 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7) Gecko/20040608 In example below onclick="save_button.style.visibility = 'visible' doesn't work Worked in previous versions - mozilla 1.6, 1.4 etc... Reproducible: Always Steps to Reproduce: 1.click image 2. 3. Actual Results: button not visible Expected Results: button visible <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Sample Test</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> </head> <body> <form name="form1" id="form1" method="post" action=""> <p>Click on image SHOULD show button works with versions <=1.6 </p> <p>&nbsp;</p> <p><img src="http://www.mozilla.org/images/mlogo.gif" onclick="save_button.style.visibility = 'visible';"/> </p> <p> <input type="submit" value="Save" name="save_button" style="VISIBILITY: hidden"> </p> </p> <p>&nbsp; </p> </form> </body> </html>
Attached file example
*** Bug 246343 has been marked as a duplicate of this bug. ***
A form element's name should not be enough to reference it according to DOM 2 Core and DOM 2 HTML. Testcase coming up.
The first case is the reporter's testcase. The following 8 ones are either cross-browser (DOM 0) ways to access/reference a form's element or DOM 2 compliant ways to reference a form's element. Not used in this testcase is DOM 2 HTML item() method.
If 2 submit form control elements of 2 different forms have the same name, say, save_button, then how is a browser software running on a machine going to decide which button to make visible if the call is save_button.style.visibility = 'visible'; ? what is a browser software going to do in such non-standardized code with 2 forms situation? Writing code comformant to W3C web standards avoids this problem and it makes sure that such code is and will be future proof, forward-compatible and browser independent. When resorting to proprietary DOM methods or attributes, then there is no assurance that the behavior of a method or attribute will remain the same in the future or that it will remain the same in all browsers. Outside the scope covered by W3C web standards/Technical Recommendations, code such as save_button.style.visibility = 'visible'; relies exclusively on each internal browser error handling which can change in any future version; it does not rely on W3C web standards which are much much more stable, future proof, browser independent. Reporter, unless I hear from you, I will resolve this bug as INVALID.
Understand - main concern is that it worked (ok handled the error the same way) with previous versions of mozilla and other current browsers. If everything is within the 1 form - I reckon 'if not specified assume current form' would be the way to go? - Just from a functional perspective.
(In reply to comment #6) > Understand - main concern is that it worked (ok handled the error the same way) > with previous versions of mozilla and other current browsers. > The best way, the safe way, cross-browser correct, future proof and forward-compatible way to avoid the particular problem you had is to resort to DOM 2 Core and DOM 2 HTML compliant methods and attributes. Next week, next month, next year, other browsers' new version might no longer support this or that non-web-standards/non-compliant ways. You may install DevEdge's sidebar references on your Mozilla browser and use them when you code, when you're not sure, etc. http://devedge.netscape.com/toolbox/sidebars/ I'm resolving this bug as INVALID.
Status: UNCONFIRMED → RESOLVED
Closed: 21 years ago
Resolution: --- → INVALID
Product: Browser → Seamonkey
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: