Error in documentation(I included a fix)

RESOLVED FIXED

Status

Documentation
Web Developer
--
trivial
RESOLVED FIXED
12 years ago
12 years ago

People

(Reporter: Ron de Bruijn, Unassigned)

Tracking

Details

(Reporter)

Description

12 years ago
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.

Comment 1

12 years ago
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
Last Resolved: 12 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.