faqts : Computers : Programming : Languages : JavaScript

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

4 of 5 people (80%) answered Yes
Recently 4 of 5 people (80%) answered Yes

Entry

how can I display all elements of a document

Apr 5th, 2008 20:00
ha mo, Glen G, Colin Fraser,


Would you care to clarify what you mean by "all elements"? 
A1.
Try a right click and then a left click on "View Source" 
A2. 
Try creating an array of all objects then write the results to another 
page. The problem is this requires so much coding that it becomes 
somewhat impractical. Good luck. 
And yes, I cheated by not offering any code.
Colin;
I'm not sure this is the correct way to respond, but I did want to get 
back to you.
thank you for your entry, I have entered below some code that somewhat 
explains what I am talking about.  As you can see this address's 
the 'id' element only.  I was looking for some routine that would 
display all possible elements.
function loader(){
   var text = "";
	for(x=0;x<document.all.length;x++){
	   if (document.all[x].id){
		var text = text+document.all[x].id;	     
	   }
	}
	alert(text);
}
Thanks;
Glen G.
[email protected]
http://www.businessian.com
http://www.computerstan.com
http://www.financestan.com
http://www.healthstan.com
http://www.internetstan.com
http://www.moneyenews.com
http://www.technologystan.com
http://www.zobab.com
http://www.healthinhealth.com