PDA

View Full Version : for loop that should run many times only runs twice?


questor
09-10-2004, 04:20 AM
For some reason the following code only output 2 lines of <tr>blahblah</tr>, even if it should run many times. Why?


if (pickedFunction == 2)
{
viewerOutput = '<table>';
<?
mysql_select_db("staff");
$sql14 = "SELECT dt FROM employment";
$sql14 = mysql_query($sql14);
while ($row = mysql_fetch_array($sql14, MYSQL_ASSOC))
{
foreach ($row as $dt)
{
echo "if (selected == ".$dt.") { for (i=1;i<magic".$dt.".length;i++) { var id = magic".$dt."[i]; component = '<tr bgcolor=\"#F0F0F0\" style=\"cursor:hand\" onmouseover=\"javascript:this.style.backgroundColor=\'#dddddd\';\" onmouseout=\"javascript:this.style.backgroundColor=\'#F0F0F0\'\" onclick=\"document.location=\'http://scwebapps/magic/detail.php?detailid=' + id + '\'\"><td align=\"center\">' + magicScore[id] + '</td></tr>'; viewerOutput += component; } }";
}
}
?>
viewerOutput += '</table>';
}

glenngv
09-10-2004, 04:38 AM
You should post the generated output of PHP. View-Source the page and post that javascript part here.

questor
09-11-2004, 01:25 AM
... :eek:


if (pickedFunction == 2)
{
viewerOutput = '<table>';
if (selected == 38688) { for (i=1;i<magic38688.length;i++) { var id = magic38688[i]; component = '<tr bgcolor="#F0F0F0" style="cursor:hand" onmouseover="javascript:this.style.backgroundColor=\'#dddddd\';" onmouseout="javascript:this.style.backgroundColor=\'#F0F0F0\'" onclick="document.location=\'http://scwebapps/magic/detail.php?detailid=' + id + '\'"><td align="center">' + magicScore[id] + '</td></tr>'; viewerOutput += component; } } if (selected == 21655) { for (i=1;i<magic21655.length;i++) { var id = magic21655[i]; component = '<tr bgcolor="#F0F0F0" style="cursor:hand" onmouseover="javascript:this.style.backgroundColor=\'#dddddd\';" onmouseout="javascript:this.style.backgroundColor=\'#F0F0F0\'" onclick="document.location=\'http://scwebapps/magic/detail.php?detailid=' + id + '\'"><td align="center">' + magicScore[id] + '</td></tr>'; viewerOutput += component; } } if (selected == 42646) { for (i=1;i<magic42646.length;i++) { var id = magic42646[i]; component = '<tr bgcolor="#F0F0F0" style="cursor:hand" onmouseover="javascript:this.style.backgroundColor=\'#dddddd\';" onmouseout="javascript:this.style.backgroundColor=\'#F0F0F0\'" onclick="document.location=\'http://scwebapps/magic/detail.php?detailid=' + id + '\'"><td align="center">' + magicScore[id] + '</td></tr>'; viewerOutput += component; } } if (selected == 12163) { for (i=1;i<magic12163.length;i++) { var id = magic12163[i]; component = '<tr bgcolor="#F0F0F0" style="cursor:hand" onmouseover="javascript:this.style.backgroundColor=\'#dddddd\';" onmouseout="javascript:this.style.backgroundColor=\'#F0F0F0\'" onclick="document.location=\'http://scwebapps/magic/detail.php?detailid=' + id + '\'"><td align="center">' + magicScore[id] + '</td></tr>'; viewerOutput += component; } } if (selected == 8462) { for (i=1;i<magic8462.length;i++) { var id = magic8462[i]; component = '<tr bgcolor="#F0F0F0" style="cursor:hand" onmouseover="javascript:this.style.backgroundColor=\'#dddddd\';" onmouseout="javascript:this.style.backgroundColor=\'#F0F0F0\'" onclick="document.location=\'http://scwebapps/magic/detail.php?detailid=' + id + '\'"><td align="center">' + magicScore[id] + '</td></tr>'; viewerOutput += component; } } if (selected == 41850) { for (i=1;i<magic41850.length;i++) { var id = magic41850[i]; component = '<tr bgcolor="#F0F0F0" style="cursor:hand" onmouseover="javascript:this.style.backgroundColor=\'#dddddd\';" onmouseout="javascript:this.style.backgroundColor=\'#F0F0F0\'" onclick="document.location=\'http://scwebapps/magic/detail.php?detailid=' + id + '\'"><td align="center">' + magicScore[id] + '</td></tr>'; viewerOutput += component; } } if (selected == 37780) { for (i=1;i<magic37780.length;i++) { var id = magic37780[i]; component = '<tr bgcolor="#F0F0F0" style="cursor:hand" onmouseover="javascript:this.style.backgroundColor=\'#dddddd\';" onmouseout="javascript:this.style.backgroundColor=\'#F0F0F0\'" onclick="document.location=\'http://scwebapps/magic/detail.php?detailid=' + id + '\'"><td align="center">' + magicScore[id] + '</td></tr>'; viewerOutput += component; } } if (selected == 37195) { for (i=1;i<magic37195.length;i++) { var id = magic37195[i]; component = '<tr bgcolor="#F0F0F0" style="cursor:hand" onmouseover="javascript:this.style.backgroundColor=\'#dddddd\';" onmouseout="javascript:this.style.backgroundColor=\'#F0F0F0\'" onclick="document.location=\'http://scwebapps/magic/detail.php?detailid=' + id + '\'"><td align="center">' + magicScore[id] + '</td></tr>'; viewerOutput += component; } } if (selected == 42067) { for (i=1;i<magic42067.length;i++) { var id = magic42067[i]; component = '<tr bgcolor="#F0F0F0" style="cursor:hand" onmouseover="javascript:this.style.backgroundColor=\'#dddddd\';" onmouseout="javascript:this.style.backgroundColor=\'#F0F0F0\'" onclick="document.location=\'http://scwebapps/magic/detail.php?detailid=' + id + '\'"><td align="center">' + magicScore[id] + '</td></tr>'; viewerOutput += component; } } if (selected == 38167) { for (i=1;i<magic38167.length;i++) { var id = magic38167[i]; component = '<tr bgcolor="#F0F0F0" style="cursor:hand" onmouseover="javascript:this.style.backgroundColor=\'#dddddd\';" onmouseout="javascript:this.style.backgroundColor=\'#F0F0F0\'" onclick="document.location=\'http://scwebapps/magic/detail.php?detailid=' + id + '\'"><td align="center">' + magicScore[id] + '</td></tr>'; viewerOutput += component; } } if (selected == 12381) { for (i=1;i<magic12381.length;i++) { var id = magic12381[i]; component = '<tr bgcolor="#F0F0F0" style="cursor:hand" onmouseover="javascript:this.style.backgroundColor=\'#dddddd\';" onmouseout="javascript:this.style.backgroundColor=\'#F0F0F0\'" onclick="document.location=\'http://scwebapps/magic/detail.php?detailid=' + id + '\'"><td align="center">' + magicScore[id] + '</td></tr>'; viewerOutput += component; } } if (selected == 40285) { for (i=1;i<magic40285.length;i++) { var id = magic40285[i]; component = '<tr bgcolor="#F0F0F0" style="cursor:hand" onmouseover="javascript:this.style.backgroundColor=\'#dddddd\';" onmouseout="javascript:this.style.backgroundColor=\'#F0F0F0\'" onclick="document.location=\'http://scwebapps/magic/detail.php?detailid=' + id + '\'"><td align="center">' + magicScore[id] + '</td></tr>'; viewerOutput += component; } } if (selected == 20656) { for (i=1;i<magic20656.length;i++) { var id = magic20656[i]; component = '<tr bgcolor="#F0F0F0" style="cursor:hand" onmouseover="javascript:this.style.backgroundColor=\'#dddddd\';" onmouseout="javascript:this.style.backgroundColor=\'#F0F0F0\'" onclick="document.location=\'http://scwebapps/magic/detail.php?detailid=' + id + '\'"><td align="center">' + magicScore[id] + '</td></tr>'; viewerOutput += component; } } if (selected == 41723) { for (i=1;i<magic41723.length;i++) { var id = magic41723[i]; component = '<tr bgcolor="#F0F0F0" style="cursor:hand" onmouseover="javascript:this.style.backgroundColor=\'#dddddd\';" onmouseout="javascript:this.style.backgroundColor=\'#F0F0F0\'" onclick="document.location=\'http://scwebapps/magic/detail.php?detailid=' + id + '\'"><td align="center">' + magicScore[id] + '</td></tr>'; viewerOutput += component; } } if (selected == 20838) { for (i=1;i<magic20838.length;i++) { var id = magic20838[i]; component = '<tr bgcolor="#F0F0F0" style="cursor:hand" onmouseover="javascript:this.style.backgroundColor=\'#dddddd\';" onmouseout="javascript:this.style.backgroundColor=\'#F0F0F0\'" onclick="document.location=\'http://scwebapps/magic/detail.php?detailid=' + id + '\'"><td align="center">' + magicScore[id] + '</td></tr>'; viewerOutput += component; } } if (selected == 41777) { for (i=1;i<magic41777.length;i++) { var id = magic41777[i]; component = '<tr bgcolor="#F0F0F0" style="cursor:hand" onmouseover="javascript:this.style.backgroundColor=\'#dddddd\';" onmouseout="javascript:this.style.backgroundColor=\'#F0F0F0\'" onclick="document.location=\'http://scwebapps/magic/detail.php?detailid=' + id + '\'"><td align="center">' + magicScore[id] + '</td></tr>'; viewerOutput += component; } } if (selected == 37779) { for (i=1;i<magic37779.length;i++) { var id = magic37779[i]; component = '<tr bgcolor="#F0F0F0" style="cursor:hand" onmouseover="javascript:this.style.backgroundColor=\'#dddddd\';" onmouseout="javascript:this.style.backgroundColor=\'#F0F0F0\'" onclick="document.location=\'http://scwebapps/magic/detail.php?detailid=' + id + '\'"><td align="center">' + magicScore[id] + '</td></tr>'; viewerOutput += component; } } if (selected == 37435) { for (i=1;i<magic37435.length;i++) { var id = magic37435[i]; component = '<tr bgcolor="#F0F0F0" style="cursor:hand" onmouseover="javascript:this.style.backgroundColor=\'#dddddd\';" onmouseout="javascript:this.style.backgroundColor=\'#F0F0F0\'" onclick="document.location=\'http://scwebapps/magic/detail.php?detailid=' + id + '\'"><td align="center">' + magicScore[id] + '</td></tr>'; viewerOutput += component; } } if (selected == 38687) { for (i=1;i<magic38687.length;i++) { var id = magic38687[i]; component = '<tr bgcolor="#F0F0F0" style="cursor:hand" onmouseover="javascript:this.style.backgroundColor=\'#dddddd\';" onmouseout="javascript:this.style.backgroundColor=\'#F0F0F0\'" onclick="document.location=\'http://scwebapps/magic/detail.php?detailid=' + id + '\'"><td align="center">' + magicScore[id] + '</td></tr>'; viewerOutput += component; } } if (selected == 39269) { for (i=1;i<magic39269.length;i++) { var id = magic39269[i]; component = '<tr bgcolor="#F0F0F0" style="cursor:hand" onmouseover="javascript:this.style.backgroundColor=\'#dddddd\';" onmouseout="javascript:this.style.backgroundColor=\'#F0F0F0\'" onclick="document.location=\'http://scwebapps/magic/detail.php?detailid=' + id + '\'"><td align="center">' + magicScore[id] + '</td></tr>'; viewerOutput += component; } } if (selected == 42166) { for (i=1;i<magic42166.length;i++) { var id = magic42166[i]; component = '<tr bgcolor="#F0F0F0" style="cursor:hand" onmouseover="javascript:this.style.backgroundColor=\'#dddddd\';" onmouseout="javascript:this.style.backgroundColor=\'#F0F0F0\'" onclick="document.location=\'http://scwebapps/magic/detail.php?detailid=' + id + '\'"><td align="center">' + magicScore[id] + '</td></tr>'; viewerOutput += component; } } if (selected == 59454) { for (i=1;i<magic59454.length;i++) { var id = magic59454[i]; component = '<tr bgcolor="#F0F0F0" style="cursor:hand" onmouseover="javascript:this.style.backgroundColor=\'#dddddd\';" onmouseout="javascript:this.style.backgroundColor=\'#F0F0F0\'" onclick="document.location=\'http://scwebapps/magic/detail.php?detailid=' + id + '\'"><td align="center">' + magicScore[id] + '</td></tr>'; viewerOutput += component; } } if (selected == 42644) { for (i=1;i<magic42644.length;i++) { var id = magic42644[i]; component = '<tr bgcolor="#F0F0F0" style="cursor:hand" onmouseover="javascript:this.style.backgroundColor=\'#dddddd\';" onmouseout="javascript:this.style.backgroundColor=\'#F0F0F0\'" onclick="document.location=\'http://scwebapps/magic/detail.php?detailid=' + id + '\'"><td align="center">' + magicScore[id] + '</td></tr>'; viewerOutput += component; } } if (selected == 6754) { for (i=1;i<magic6754.length;i++) { var id = magic6754[i]; component = '<tr bgcolor="#F0F0F0" style="cursor:hand" onmouseover="javascript:this.style.backgroundColor=\'#dddddd\';" onmouseout="javascript:this.style.backgroundColor=\'#F0F0F0\'" onclick="document.location=\'http://scwebapps/magic/detail.php?detailid=' + id + '\'"><td align="center">' + magicScore[id] + '</td></tr>'; viewerOutput += component; } } if (selected == 38960) { for (i=1;i<magic38960.length;i++) { var id = magic38960[i]; component = '<tr bgcolor="#F0F0F0" style="cursor:hand" onmouseover="javascript:this.style.backgroundColor=\'#dddddd\';" onmouseout="javascript:this.style.backgroundColor=\'#F0F0F0\'" onclick="document.location=\'http://scwebapps/magic/detail.php?detailid=' + id + '\'"><td align="center">' + magicScore[id] + '</td></tr>'; viewerOutput += component; } } if (selected == 42422) { for (i=1;i<magic42422.length;i++) { var id = magic42422[i]; component = '<tr bgcolor="#F0F0F0" style="cursor:hand" onmouseover="javascript:this.style.backgroundColor=\'#dddddd\';" onmouseout="javascript:this.style.backgroundColor=\'#F0F0F0\'" onclick="document.location=\'http://scwebapps/magic/detail.php?detailid=' + id + '\'"><td align="center">' + magicScore[id] + '</td></tr>'; viewerOutput += component; } } if (selected == 41631) { for (i=1;i<magic41631.length;i++) { var id = magic41631[i]; component = '<tr bgcolor="#F0F0F0" style="cursor:hand" onmouseover="javascript:this.style.backgroundColor=\'#dddddd\';" onmouseout="javascript:this.style.backgroundColor=\'#F0F0F0\'" onclick="document.location=\'http://scwebapps/magic/detail.php?detailid=' + id + '\'"><td align="center">' + magicScore[id] + '</td></tr>'; viewerOutput += component; } } if (selected == 60847) { for (i=1;i<magic60847.length;i++) { var id = magic60847[i]; component = '<tr bgcolor="#F0F0F0" style="cursor:hand" onmouseover="javascript:this.style.backgroundColor=\'#dddddd\';" onmouseout="javascript:this.style.backgroundColor=\'#F0F0F0\'" onclick="document.location=\'http://scwebapps/magic/detail.php?detailid=' + id + '\'"><td align="center">' + magicScore[id] + '</td></tr>'; viewerOutput += component; } } if (selected == 41665) { for (i=1;i<magic41665.length;i++) { var id = magic41665[i]; component = '<tr bgcolor="#F0F0F0" style="cursor:hand" onmouseover="javascript:this.style.backgroundColor=\'#dddddd\';" onmouseout="javascript:this.style.backgroundColor=\'#F0F0F0\'" onclick="document.location=\'http://scwebapps/magic/detail.php?detailid=' + id + '\'"><td align="center">' + magicScore[id] + '</td></tr>'; viewerOutput += component; } } if (selected == 23850) { for (i=1;i<magic23850.length;i++) { var id = magic23850[i]; component = '<tr bgcolor="#F0F0F0" style="cursor:hand" onmouseover="javascript:this.style.backgroundColor=\'#dddddd\';" onmouseout="javascript:this.style.backgroundColor=\'#F0F0F0\'" onclick="document.location=\'http://scwebapps/magic/detail.php?detailid=' + id + '\'"><td align="center">' + magicScore[id] + '</td></tr>'; viewerOutput += component; } } if (selected == 59785) { for (i=1;i<magic59785.length;i++) { var id = magic59785[i]; component = '<tr bgcolor="#F0F0F0" style="cursor:hand" onmouseover="javascript:this.style.backgroundColor=\'#dddddd\';" onmouseout="javascript:this.style.backgroundColor=\'#F0F0F0\'" onclick="document.location=\'http://scwebapps/magic/detail.php?detailid=' + id + '\'"><td align="center">' + magicScore[id] + '</td></tr>'; viewerOutput += component; } } if (selected == 60757) { for (i=1;i<magic60757.length;i++) { var id = magic60757[i]; component = '<tr bgcolor="#F0F0F0" style="cursor:hand" onmouseover="javascript:this.style.backgroundColor=\'#dddddd\';" onmouseout="javascript:this.style.backgroundColor=\'#F0F0F0\'" onclick="document.location=\'http://scwebapps/magic/detail.php?detailid=' + id + '\'"><td align="center">' + magicScore[id] + '</td></tr>'; viewerOutput += component; } } if (selected == 60893) { for (i=1;i<magic60893.length;i++) { var id = magic60893[i]; component = '<tr bgcolor="#F0F0F0" style="cursor:hand" onmouseover="javascript:this.style.backgroundColor=\'#dddddd\';" onmouseout="javascript:this.style.backgroundColor=\'#F0F0F0\'" onclick="document.location=\'http://scwebapps/magic/detail.php?detailid=' + id + '\'"><td align="center">' + magicScore[id] + '</td></tr>'; viewerOutput += component; } } if (selected == 60777) { for (i=1;i<magic60777.length;i++) { var id = magic60777[i]; component = '<tr bgcolor="#F0F0F0" style="cursor:hand" onmouseover="javascript:this.style.backgroundColor=\'#dddddd\';" onmouseout="javascript:this.style.backgroundColor=\'#F0F0F0\'" onclick="document.location=\'http://scwebapps/magic/detail.php?detailid=' + id + '\'"><td align="center">' + magicScore[id] + '</td></tr>'; viewerOutput += component; } } if (selected == 60842) { for (i=1;i<magic60842.length;i++) { var id = magic60842[i]; component = '<tr bgcolor="#F0F0F0" style="cursor:hand" onmouseover="javascript:this.style.backgroundColor=\'#dddddd\';" onmouseout="javascript:this.style.backgroundColor=\'#F0F0F0\'" onclick="document.location=\'http://scwebapps/magic/detail.php?detailid=' + id + '\'"><td align="center">' + magicScore[id] + '</td></tr>'; viewerOutput += component; } } if (selected == 26361) { for (i=1;i<magic26361.length;i++) { var id = magic26361[i]; component = '<tr bgcolor="#F0F0F0" style="cursor:hand" onmouseover="javascript:this.style.backgroundColor=\'#dddddd\';" onmouseout="javascript:this.style.backgroundColor=\'#F0F0F0\'" onclick="document.location=\'http://scwebapps/magic/detail.php?detailid=' + id + '\'"><td align="center">' + magicScore[id] + '</td></tr>'; viewerOutput += component; } } if (selected == 60908) { for (i=1;i<magic60908.length;i++) { var id = magic60908[i]; component = '<tr bgcolor="#F0F0F0" style="cursor:hand" onmouseover="javascript:this.style.backgroundColor=\'#dddddd\';" onmouseout="javascript:this.style.backgroundColor=\'#F0F0F0\'" onclick="document.location=\'http://scwebapps/magic/detail.php?detailid=' + id + '\'"><td align="center">' + magicScore[id] + '</td></tr>'; viewerOutput += component; } } if (selected == 60882) { for (i=1;i<magic60882.length;i++) { var id = magic60882[i]; component = '<tr bgcolor="#F0F0F0" style="cursor:hand" onmouseover="javascript:this.style.backgroundColor=\'#dddddd\';" onmouseout="javascript:this.style.backgroundColor=\'#F0F0F0\'" onclick="document.location=\'http://scwebapps/magic/detail.php?detailid=' + id + '\'"><td align="center">' + magicScore[id] + '</td></tr>'; viewerOutput += component; } } if (selected == 60812) { for (i=1;i<magic60812.length;i++) { var id = magic60812[i]; component = '<tr bgcolor="#F0F0F0" style="cursor:hand" onmouseover="javascript:this.style.backgroundColor=\'#dddddd\';" onmouseout="javascript:this.style.backgroundColor=\'#F0F0F0\'" onclick="document.location=\'http://scwebapps/magic/detail.php?detailid=' + id + '\'"><td align="center">' + magicScore[id] + '</td></tr>'; viewerOutput += component; } } if (selected == 61289) { for (i=1;i<magic61289.length;i++) { var id = magic61289[i]; component = '<tr bgcolor="#F0F0F0" style="cursor:hand" onmouseover="javascript:this.style.backgroundColor=\'#dddddd\';" onmouseout="javascript:this.style.backgroundColor=\'#F0F0F0\'" onclick="document.location=\'http://scwebapps/magic/detail.php?detailid=' + id + '\'"><td align="center">' + magicScore[id] + '</td></tr>'; viewerOutput += component; } } if (selected == 10144) { for (i=1;i<magic10144.length;i++) { var id = magic10144[i]; component = '<tr bgcolor="#F0F0F0" style="cursor:hand" onmouseover="javascript:this.style.backgroundColor=\'#dddddd\';" onmouseout="javascript:this.style.backgroundColor=\'#F0F0F0\'" onclick="document.location=\'http://scwebapps/magic/detail.php?detailid=' + id + '\'"><td align="center">' + magicScore[id] + '</td></tr>'; viewerOutput += component; } } if (selected == 61057) { for (i=1;i<magic61057.length;i++) { var id = magic61057[i]; component = '<tr bgcolor="#F0F0F0" style="cursor:hand" onmouseover="javascript:this.style.backgroundColor=\'#dddddd\';" onmouseout="javascript:this.style.backgroundColor=\'#F0F0F0\'" onclick="document.location=\'http://scwebapps/magic/detail.php?detailid=' + id + '\'"><td align="center">' + magicScore[id] + '</td></tr>'; viewerOutput += component; } } if (selected == 58479) { for (i=1;i<magic58479.length;i++) { var id = magic58479[i]; component = '<tr bgcolor="#F0F0F0" style="cursor:hand" onmouseover="javascript:this.style.backgroundColor=\'#dddddd\';" onmouseout="javascript:this.style.backgroundColor=\'#F0F0F0\'" onclick="document.location=\'http://scwebapps/magic/detail.php?detailid=' + id + '\'"><td align="center">' + magicScore[id] + '</td></tr>'; viewerOutput += component; } } if (selected == 36927) { for (i=1;i<magic36927.length;i++) { var id = magic36927[i]; component = '<tr bgcolor="#F0F0F0" style="cursor:hand" onmouseover="javascript:this.style.backgroundColor=\'#dddddd\';" onmouseout="javascript:this.style.backgroundColor=\'#F0F0F0\'" onclick="document.location=\'http://scwebapps/magic/detail.php?detailid=' + id + '\'"><td align="center">' + magicScore[id] + '</td></tr>'; viewerOutput += component; } } viewerOutput += '</table>';
}

Roy Sinclair
09-13-2004, 05:04 PM
That is one small chunk of code altered slightly and repeated until it's an enormous chunk of code.

A slight modification would allow it to run as a single small chunk of code:


if (pickedFunction == 2)
{
viewerOutput = '<table>';
var mymagic = document['magic' + selected]
for (i=1;i<mymagic.length;i++)
{
var id = mymagic[i];
component = '<tr bgcolor="#F0F0F0" style="cursor:hand"
onmouseover="javascript:this.style.backgroundColor=\'#dddddd\';"
onmouseout="javascript:this.style.backgroundColor=\'#F0F0F0\'"
onclick="document.location=\'http://scwebapps/magic/detail.php?detailid=' + id + '\'">
<td align="center">' + magicScore[id] + '</td></tr>'; viewerOutput += component;
}
viewerOutput += '</table>';
}



I'll leave it up to you to get it back to the original PHP but this would dramatically reduce the size of the generated page and thus free up network loading.

glenngv
09-14-2004, 03:46 AM
Shouldn't it be window and not document?

window['magic' + selected]

Roy Sinclair
09-14-2004, 03:32 PM
You're right it should be window, document will probably only work right for users of IE.

questor
09-15-2004, 03:30 AM
Actually, only IE users will be using it. Thank you for finding an optimization. Turns out that /sigh/ a size of a frame set before hand was making it APPEAR to only run twice. It was working correctly the entire time. /slaps forehead/

How about that, huh?

Roy Sinclair
09-15-2004, 04:45 PM
As long as the problem is solved :thumbsup: .

The optimization should help a lot too.

glenngv
09-16-2004, 02:24 AM
You're right it should be window, document will probably only work right for users of IE.
It works in Firefox too, and I assume for other browsers also. But window.varName is different from document.varName. Try this demo:

<script type="text/javascript">
var blah = "bar";
document.blah = "foo";
alert(window.blah); //alerts "bar"
alert(document.blah); //alerts "foo"
</script>