+ Reply to Thread
Results 1 to 2 of 2

Thread: Write HTML value inside HTML TAG

  1. #1
    Junior Member
    Join Date
    Jan 2012
    Posts
    15

    Write HTML value inside HTML TAG

    I want to know how can i override my original HTML Code using JS ?
    I would like to edit my HTML Tags from JS function.

  2. #2
    Junior Member
    Join Date
    Jun 2012
    Posts
    10
    1) create a Tag and give it ID :
    <><><><><><><><><><><><><><><><>
    Code:
    <p id="demo"></p>
    2) create a JS Function :
    <><><><><><><><><><><><><>
    Code:
    <script type="text/javascript">
    function D()
    {
    	document.getElementById("demo").innerHTML="My First JavaScript";
    }
    </script>
    3) Call the function :
    <><><><><><><><><><><>
    Code:
    <body onload="D()">
    4) Overall Code :
    <><><><><><><><><>
    Code:
    <html>
    
    <head>
    <script type="text/javascript">
    function D()
    {
    	document.getElementById("demo").innerHTML="My First JavaScript";
    }
    </script>
    </head>
    
    <body onload="D()">
    	<p id="demo"></p>
    </body>
    </html>
    Hope that Helps.

+ Reply to Thread

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts