...

View Full Version : Get Table Data from a Class



arsalan660
12-14-2010, 07:13 AM
Here is the Code of the Table


<table id="commentary" class="display commentary" width="100%">

<tr class="oversummary"><td colspan="2">&nbsp;</td><td>

End of over 1 (13 runs) - fubar(13-1). 155 runs required from 19 overs. RR 13.00 RRR 8.16 <br/>F. Amjad 10 (4b) , C. Dowe 3 (1b) , S. Hadad 1-0-13-1
</td></tr>

I want a code by which Bold text can be seen on a new window by clicking on a link and that window refreshes after 30 seconds.

arsalan660
12-14-2010, 10:40 AM
I think I have asked a difficult one.

Please only tell how to get a data from a table having class. Only for Firefox

Old Pedant
12-14-2010, 09:11 PM
??? which class???

You mean "oversummary"?

And what is the point of refreshing the popup every 30 seconds if the data in the main page has not changed?

arsalan660
12-17-2010, 01:45 PM
Yes I mean oversummary

This is commentary of a cricket match and it changes after sometime thats why I also want a popup which refresh and gets the latest info.

Old Pedant
12-17-2010, 08:18 PM
Hmmm....I don't know if this will work or not, but I guess you can try it.

Creating the popup is easy:


<a target="WATCHER" href="watcher.html"
onclick="window.open('','WATCHER','height=200,width=500,scrollbars=no,status=no');">
click to open watcher window
</a>

Then the code for "watcher.html":


<html>
<head>
<script type="text/javascript">
function update( )
{
var here = document.getElementById("putItHere");
var tbl = opener.document.getElementById("commentary");
var rows = tbl.getElementsByTagName("tr");
for ( var r = 0; r < rows.length; ++r ) {
var row = rows[r];
if ( row.className == "oversummary" ) {
var cell = row.getElementsByTagName("td")[1]; // get the second td
here.innerHTML = cell.innerHTML;
setTimeout( update, 30000 ); // do this again in 30 seconds
return;
}
}
// if we get here, we couldn't find the cell in the opener:
here.innerHTML = "<b>Data no longer available</b>";
}
</script>
</head>
<body onload="update()">
<h2>Summary:</h2><br>
<h3 id="putItHere"></h3>
</body>
</html>


I'm not at all clear what the point in this is. If the opener window is closed, then the watcher window will no longer be able to get the summary. So why bother with the separate window? Just keep looking at the original information on the original page.

arsalan660
12-18-2010, 05:20 PM
Thanks but Refresh not working. page is not refreshing



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum