onclick handler not called

RESOLVED INVALID

Status

SeaMonkey
General
RESOLVED INVALID
14 years ago
14 years ago

People

(Reporter: Gwyn Cole, Unassigned)

Tracking

Trunk
x86
Windows XP

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

14 years ago
User-Agent:       Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8a3) Gecko/20040718

The following HTML demontrates that the onclick handler doesn't get called. 
The following works in IE and Opera.

<html>
<head><title>OnClick bug</title></head>
<script language="javascript">
	function ShowTextBox()
	{
		myDIV.className = "show_div";
	}
</script>
<style>
b 
{
	font-weight: bold;
	text-decoration: underline;
	cursor: hand;
} 
div.hide_div
{
	display: none;
}
div.show_div
{
	display: block;
	position: absolute;
	top: 4em;
	left: 2em;
	background-color: #ffffe1;
	border: solid 1px #D6D2C1;
}
</style>
<body>
	<p>Click <b onclick="ShowTextBox()">this bold text</b>...</p>
	<div id="myDIV" class="hide_div"><p>Hello... You see... it worked!
</p></div>
</body>
</html>


Reproducible: Always
Steps to Reproduce:
1. Save the HTML in the details section to a file.
2. Open the file in the browser
3. Click the text in the bold highlight

Actual Results:  
The ShowTextBox javascript does not get called.

Expected Results:  
The ShowTextBox javascript should display the another message on the page
(Reporter)

Comment 1

14 years ago
Created attachment 153657 [details]
The HTML document to recreate the bug

Recreates the onclick handler bug
(Reporter)

Updated

14 years ago
Summary: onlick handler not called → onclick handler not called

Comment 2

14 years ago

*** This bug has been marked as a duplicate of 46117 ***
Status: UNCONFIRMED → RESOLVED
Last Resolved: 14 years ago
Resolution: --- → DUPLICATE

Comment 3

14 years ago
(In reply to comment #2)
> 
> *** This bug has been marked as a duplicate of 46117 ***

Myabe I'm missing something but on yesterday's Firefox Aviary nightly it fails
because the reporter hasn't defined DIV1 in the click handler, i.e.:

myDIV.className = "show_div";

instead of:

document.getElementById('myDIV').className = "show_div";

Comment 4

14 years ago
Oops, brain failure:

"hasn't defined DIV1"

obviously I meant:

"hasn't defined myDIV"

Comment 5

14 years ago
Yes, you're right - my bad.
Status: RESOLVED → UNCONFIRMED
Resolution: DUPLICATE → ---

Comment 6

14 years ago
-> INVALID
Status: UNCONFIRMED → RESOLVED
Last Resolved: 14 years ago14 years ago
Resolution: --- → INVALID
Product: Browser → Seamonkey
You need to log in before you can comment on or make changes to this bug.