Jump to content

Help in DHTML collections


The-Eagle-Eye

Recommended Posts

Below are two html files showing example for Collection All and Childern respectively.I want to " ! " this exclamation mark in the output says that its a comment tag,then why it is apperaring after title tag instead of apperaring before head tag?

<HTML><!-- some comments --><!-- some comments --><HEAD><TITLE> DHTML - Collection All </TITLE><script LANGUAGE = "JavaScript">  var elements = "";  function start()   {      for ( var loop = 0; loop < document.all.length; ++loop )         elements += "<BR>" + document.all[ loop ].tagName;      pText.innerHTML += elements;  }</SCRIPT></HEAD><BODY ONLOAD = "start()"><P ID = "pText">Elements on this Web page:</P></BODY></HTML>
<HTML><!-- some comments --><!-- some comments --><HEAD><TITLE> DHTML - Collection Children </TITLE><script LANGUAGE = "JavaScript">  var elements = "<UL>";  function child( object )   {        var loop = 0;      elements += "<LI>" + object.tagName + "<UL>";       for( loop = 0; loop < object.children.length; loop++ )   {            if ( object.children[loop].children.length )                    child( object.children[ loop ] );        else            elements += "<LI>" + object.children[ loop ].tagName                         + "</LI>";      }      elements += " </UL> ";  }</SCRIPT></HEAD><BODY ONLOAD = "child( document.all[ 1 ] );                 myDisplay.outerHTML += elements;"><P>Welcome to our <STRONG>Web</STRONG> page!</P><P ID = "myDisplay">Elements on this Web page:</P></BODY></HTML>
Thanx in Advance.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...