Last Comment Bug 303283 - Error in documentation(I included a fix)
: Error in documentation(I included a fix)
Status: RESOLVED FIXED
:
Product: Documentation
Classification: Graveyard
Component: Web Developer (show other bugs)
: unspecified
: All All
: -- trivial (vote)
: ---
Assigned To: Web Developer Docs
:
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2005-08-03 12:07 PDT by Ron de Bruijn
Modified: 2005-10-12 06:03 PDT (History)
0 users
See Also:
QA Whiteboard:
Iteration: ---
Points: ---


Attachments

Description Ron de Bruijn 2005-08-03 12:07:05 PDT
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 Yuh-Ruey Chen 2005-10-12 06:03:06 PDT
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);
}

Note You need to log in before you can comment on or make changes to this bug.