• Archives

  • Using get element by id

    By admin | January 17, 2008

    Get element by id is a function which will return the the content inside a element for example

    Example

    <html>

    <head>

    <script type=”text/javascript” >

    function gebid(){

    var xyz=document.getElementById(“text”);

    alert(xyz.innerHTML);

    }

    </script>

    </head>

    <body>

    <h1 id=”text” onclick=”gebid()”>You will see this same text when you will click here</h1>

    </body>

    </html>

    Thanks

    krates

    Topics: Javascript | 4 Comments »

    Related Links: