JAVA SCRIPT BASICS
Hello everyone ...
today lets take a look on Java Script basics. so buddies please don't be impatient, this series will improve gradually... & hope will benefit both groups of Non programmer or Just programmer of any hard core language.
So let's have a look on these two statements.
1) document.getElementById("id_name").innerHTML="My first HTML text";
2) var x = document.getElementById("id_name");
x.innerHTML = "My Second HTML text";
Lets see some explanation regarding these two statements.
The first one says "Put the the text ("... ") on the right hand of assignment or equals to sign in the HTML of id_name.
now, see , how it works... it says , that is, Browser looks over it in following manner- Get me the HTML property of Element specified by the ID namely "id_name" in the respective document.
So that was the story of how we would put our own hand written HTML or just TEXT or it also may possible some output stored in some variable.
Now... look over 2nd statement- what it says- Two points..
i) Store the ID retrieved using the specific Element of available document.
ii) Similar to the first statement but with a little twist which is as -"put this user one HTML /TEXT in the HTML property of ID stored in the variable 'x'
Post a Comment