Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Jun 2002
    Posts
    77
    Thanks
    0
    Thanked 0 Times in 0 Posts

    how can i get the page tags

    Hello
    is there any way to get the html tags from the page BUT
    all the html tags including the <head> and what between then </head> and meta tags
    ....
    without warping the page with <span id=blah> tag?

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts
    not sure what you're asking ... there's a method:

    Code:
    document.getElementsByTagName("div")

    which returns an array of objects - in this case, all the div tags on the page

  • #3
    Regular Coder
    Join Date
    Jun 2002
    Posts
    185
    Thanks
    0
    Thanked 0 Times in 0 Posts
    var elList = document.body.getElementsByTagName("*");

    will give you all the elements within the BODY tag.

  • #4
    New Coder
    Join Date
    Jun 2002
    Posts
    77
    Thanks
    0
    Thanked 0 Times in 0 Posts
    what i like to do is kinda simple
    if i have this simple html

    -----------------------------------------------------
    <HTML>
    <HEAD id="blah">
    <script>
    function foo()
    {
    var x=document.getElementsByTagName("Head")
    alert(x.[1].id);


    }

    </script>
    <TITLE></TITLE>
    </HEAD>
    <BODY id="blah">

    <input type=button value=press id="blah" onclick=foo()>

    </BODY>
    </HTML>
    ------------------------------------------------------------
    as you see im trying to get the <HEAD> tag id value but the
    page gives me erorr ..
    what am i doing wrong ?

    tnx for the helpers

  • #5
    jkd
    jkd is offline
    Senior Coder jkd's Avatar
    Join Date
    May 2002
    Location
    metro DC
    Posts
    3,163
    Thanks
    1
    Thanked 18 Times in 18 Posts
    document.getElementsByTagName('head').item(0).getAttribute('id')


  •  

    Posting Permissions

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