Closed Bug 303283 Opened 19 years ago Closed 19 years ago

Error in documentation(I included a fix)

Categories

(Documentation Graveyard :: Web Developer, defect)

defect
Not set
trivial

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: iampure, Unassigned)

Details

User-Agent:       Mozilla/5.0 (compatible; Konqueror/3.4; FreeBSD) KHTML/3.4.1 (like Gecko)
Build Identifier: 

This is developers information. The example is not correctly rendered, either 
because it's invalid, because it doesn't include a body tag, or because the 
implementation is incorrect.  
 
http://www.mozilla.org/docs/dom/domref/dom_intro.html#997518 
 
I fixed the example. This has the correct result. For the future: would you 
please verify whether the examples you include in the documentation actually 
work.  
  
Fix:  
<html> 
<body> 
 <script> 
   // create a couple of elements    // in an otherwise empty HTML page 
   heading = document.createElement("H1"); 
   heading_text = document.createTextNode("Big Head!"); 
   heading.appendChild(heading_text); 
   document.body.appendChild(heading); 
    </script> 
</body> 
 </html> 
 
 
 

Reproducible: Always

Steps to Reproduce:
1.Go to http://www.mozilla.org/docs/dom/domref/dom_intro.html#997518 
2.Copy example to file 
3.Load file in any webbrowser 
 
Actual Results:  
I got an empty page 

Expected Results:  
It should have displayed Big Head.
fixed:
http://developer.mozilla.org/en/docs/Gecko_DOM_Reference:Introduction#How_Do_I_Access_the_DOM.3F

// run this function when the document is loaded
window.onload = function() {
   // create a couple of elements 
   // in an otherwise empty HTML page
   heading = document.createElement("h1");
   heading_text = document.createTextNode("Big Head!");
   heading.appendChild(heading_text);
   document.body.appendChild(heading);
}
Status: UNCONFIRMED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.