HOW TO ACCESS HTML TAG INSIDE JAVASCRIPT

 HOW TO ACCESS <HTML> TAG INSIDE JAVASCRIPT:-


-In this concept using two specific methods


1)using control ID method.

2)getelement by ID method.


1)CONTROL ID METHOD:-

-in this method provides ID attribute in <HTML>.

EX.

   <p id="p1"> </p>

   <font id="f1"> </font>

   


2)GETELEMENT BY ID METHOD:-

- in this method Access all Tag using specific ID.

SYNTAX:-

      getElementById("id")

EX.

  getElementById("p1")

  getElementByID("f1")


<html>

<head>

<script language="JavaScript">


 function display()

 {

 document.getElementById("p1").innerHTML="Welcome";

 }

 

</script>

</head>

<body>

<p id="p1"> </P>

<br>

<button onclick="display()"> SUBMIT </button>

</body>

</html>


Comments

Popular posts from this blog

HTML FORMS

condition management IF, ELSE, ELSEIF

HTML NOTES