Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Javascript - innerHTML

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 121
    Comment on it

    For writing dynamic html on the html document, we use innerHTML property of javascript.
    It is basically used in the web pages to create the dynamic html such as registration form, comment form etc.

    Example

    <html>
    <body>
    <script type="text/javascript" >  
    function showform() {  
    var data="Name:<br><input type='text' name='name'><br>Comment:<br><textarea rows='5' cols='50'></textarea><br><input type='submit' value='comment'>";  
    
    document.getElementById('myloc').innerHTML=data;  
     }  
    
    </script>  
    <form name="myForm">  
    <input type="button" value="comment" onclick="showform()">  
    <div id="myloc"></div>  
    </form>  
    </body>
    </html>
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: