Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DOM.getelementsbyTagName help needed!

Status
Not open for further replies.

Riorin

Programmer
Mar 12, 2007
2
HR
I'm trying to extract data from certain web sites that keep all data in Javascript generated tables.

I thought getting the content of each Table or TableCell element by using javascript in address line of a browser could do the trick.

However, I failed at the first obstacle!

After putting

javascript: tbls = document.getElementsByTagName("table"); nmbroftables=tbls.length; alert(nmbroftables)

in address line of a browser I get the message that number of tables is 0 although the page of interest is full of tables and Web Developer add-in for Mozilla cleary recognizes them and can outline them!

The page of interest is hr and you can click on Ponedjeljak (Monday), Utorak (Tuesday) and so on to see offers for that day created dynamically and put into HTML tables!

So what should I do to retrieve that content?

Many thanks!
 
The website page is framed, there are no tables in the outermost frameset. Hence 0.

The frames are named: container, header, main and bottom.

By the way ... You can get the frame map of any page by running this bookmarklet:
Code:
javascript:var%20f1Lt="";var%20ma8i=999;var%20ma9j=999;for(i=0;i<ma8i;i++){if(top.frames[i]){f1Lt+=i+"=,"+top.frames[i].name+"==%20"+top.frames[i].location+":\n";for(j=0;j<ma9j;j++){if(top.frames[i].frames[j]){f1Lt+=i+","+j+"=."+top.frames[i].frames[j].name+"==."+top.frames[i].frames[j].location+";\n";}}}}alert(f1Lt);


 
Thanks friendlyposter, that was very useful, really appreciate it!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top