View Full Version : 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?
brothercake
07-23-2002, 03:19 PM
not sure what you're asking ... there's a method:
document.getElementsByTagName("div")
which returns an array of objects - in this case, all the div tags on the page
BrainJar
07-23-2002, 04:13 PM
var elList = document.body.getElementsByTagName("*");
will give you all the elements within the BODY tag.
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
document.getElementsByTagName('head').item(0).getAttribute('id')
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.