Closed
Bug 237541
Opened 20 years ago
Closed 20 years ago
Getelementbyid('id').innerHTML="this" doesn't work unless "id" div tags already contain something...
Categories
(Firefox :: General, defect)
Tracking
()
RESOLVED
DUPLICATE
of bug 237536
People
(Reporter: lauriek, Assigned: bugzilla)
Details
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6) Gecko/20040206 Firefox/0.8 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6) Gecko/20040206 Firefox/0.8 The following html works fine:- <div id='helpcontent'>Help</div> <script type="text/javascript"> <!-- var whichHelpPage="$helppage$"; opHtml="<font class='normal'><br>"; switch(whichHelpPage) { case "home": opHtml+="The Homepage consists of the following pages squeezed into one easy to digest bite:-"; break; default: opHtml+="The Homepage consists of the following pages squeezed into one easy to digest bite:-"; break; } opHtml+="</font><br><br>"; document.getElementById("helpcontent").innerHTML = opHtml; // --> </script> But if you remove the initial content from the div at the top leaving <div id='helpcontent'></div> Then the getElementById("helpcontent").innerHTML method reports document.getElementbyId("helpcontent") has no properties... I /think/ this should be considered a bug and I've searched the lists of known bugs but not come across this. Please forgive me for wasting your time if this is one of those cases where IE is too forgiving and that this is correct behaviour! Cheers! Reproducible: Always Steps to Reproduce: 1. Enter the html code in the details section above, try it - it works 2. Remove the initial content from the div and try again, it doesn't work.. 3. Actual Results: Firefox reports document.getElementbyId("helpcontent") has no properties... Expected Results: It should have substituted in the variable I was passing in:- document.getelementbyid("blah").innerHTML = htmlStuff htmlStuff - into the DIV.
Comment 1•20 years ago
|
||
*** This bug has been marked as a duplicate of 237536 ***
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•