Question : getElementByID not loading text

Hi eee:
 I was wondering why my document.getElementByID is not loading the corresponding text. ANy ideas?
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
<html>
<head>
<script type="text/javascript">
function getValue()
  {
  var x=document.getElementById("myHeader");
  alert(x.innerHTML);
  }
</script>
<script type="text/javascript"> 
 
	function init()
	{
		about = document.getElementById("about_us");
		trends = document.getElementById("trends");
		comments = document.getElementById("comments");
		cu = document.getElementById("contact_us");
 
		while(document.getElementById("content").hasChildNodes())
		{
			document.getElementById("content").removeChild(document.getElementById("content").lastChild);
		}
		document.getElementById("content").appendChild(about);
	}
 
	function load_program(p_no)
	{
 
		while(document.getElementById("content").hasChildNodes())
		{
			document.getElementById("content").removeChild(document.getElementById("content").lastChild);
		}
		
		switch(p_no)
		{
		case 0:
		document.getElementById("content").appendChild(about);
		break;
 
		case 1:
		document.getElementById("content").appendChild(trends);
		break;
 
		case 2:
		document.getElementById("content").appendChild(comments);
		break;
 
 
        case 3:
		document.getElementById("content").appendChild(cu);
		break;
		}
	}
 
 
</script>
</head>
<body>

<h1 id="myHeader" onclick="getValue()">Click me!</h1>

<div align="left"><br /> 
	<a href="javascript:load_program(0);">About Us</a>  | <a href="javascript:load_program(1);">Trends</a> | <a href="javascript:load_program(2);"> Comments</a> | <a href="javascript:load_program(3);"> Contact Us</a> </p> 
        </div>
<div id="content" >
			<div id="about_us" ><strong>Traditional Fashion</strong><br>
			<div align="left">Vision            </div>
				<div align="justify">
					Our&nbsp; purpose is to expose the   general masses to the old and gold recipes and fashions<br /> 
				<div align="left"></div>
				</div>
				
           
             <div align="left">Mission </div>
				<div align="justify">
					This will be achieved by classes, word of mouth and a free trial.<br />  
			    <div align="left"></div>
				</div>
 
			 <div align="left">Values </div>
				<div align="justify">
					We stand by our products<br />       
			    <div align="left"></div>
				</div> 
			</div>
			<div  id="trends" >Trends<br><br>
			<div align="justify">
                                Dont follow CK and Armani. Follow the old beauties that had grace and beauty in place of racous vivacity.
                 <br /> 
			</div> 

<div  id="comments" > Comments<br><br>
			<div align="justify">
					Many comments from people who tried our products are coming soon!</div>
			
			</div>
</div>

</body>
</html>

Answer : getElementByID not loading text

You need to create global vars (trends, about, comments and cu) :

<script type="text/javascript">
 
       var trends, about, comments, cu;
 
      function init()
      {

and call init after page load :

<body onload="init();">
Random Solutions  
 
programming4us programming4us