Wednesday, October 19, 2011

innerHTML


document.write("Hello Dolly");

above line writes any thing on page


 lets add some text to tabs;

This is when you want to add some thing in between tags

like <p></p> now if you want to add your name then use innerHTML

eg :

lets give id to the p tag so that its recognized easily "

so now it becomes : <p id="test"></p>

document.getElementById("test").innerHTML="new text added by inner HTML";

Don't be greedy : this dosent mean you can type all these in single line

document.getElementById("test").innerHTML="hello";
document.getElementById("test").innerHTML="umesh";
document.getElementById("test").innerHTML="kumar";

only last one will show;







No comments:

Post a Comment