...

View Full Version : how can i get the page tags



umen
07-23-2002, 01:00 PM
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, 04: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, 05:13 PM
var elList = document.body.getElementsByTagName("*");

will give you all the elements within the BODY tag.

umen
07-23-2002, 06:28 PM
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

jkd
07-23-2002, 07:07 PM
document.getElementsByTagName('head').item(0).getAttribute('id')



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum