innerHTML by node id
<p>In javascript, when I replace content of node of  <code>id="demo"</code> by using <code>getElementById("demo").innerHTML="SOME TEXT";</code>  I get a strange problem that it's effect is lasting for only a few seconds. When I add a alert box for the same along with the above, the effect can be seen on background screen untill the alertbox is closed by clicking on 'OK'. Can someone suggest a solution to How I can make it remain there without getting changed untill I refresh the page ..)</p>

<p>Hi all,my code is a simple sort program as follows:                                                                 </p>

<pre><code>  &lt;script type="text/javascript"&gt;
var num=new Array(12,5,8,23,1);
var len;
function sort(){
len= num.length;
for(i=0; i&lt;len-1; i++){
  for(j=0; j&lt;len-i; j++){
    if(num[j]&gt;num[j+1]){
     var tem=num[j];
     num[j]= num[j+1];
     num[j+1]= tem;
    }    
}
}
var x=document.getElementById("demo");
x.innerHTML=num;
alert(num);
}
&lt;/script&gt;                                                                                           &lt;form&gt;
        &lt;p id="demo"&gt;Click the button&lt;/p&gt;
        &lt;input type="submit" onclick="sort();" value="Click"&gt;&lt;/input&gt;
     &lt;/form&gt;
</code></pre>
