Tails
02-06-2003, 11:38 PM
I have a big problem. I'm trying to write a script that detects the
width of the browser window and make images in a table wrap. My formula for t below is get the amount of times an image of 105
width can be displayed in a certain width of the width of the window without scrolling. (the images are actually 100px but I am taking margins and cellspacing into effect as an estimate). And the images are supposed to wrap upon loading. But When the page loads, v returns as nothing (the first value assigned). I originally omitted the FORM part thinking that the values assigned to v in d() would pass on. But they didn't. So when I made the form to get the values passed on and reloaded, v once again returned nothing. But when reloaded, v gets the proper value that was assigned in d(). Why? Strangely, it will keep
showing the proper value from then on when you refresh (but I need it to be right the first time). But it will start at nothing again if you make a change to the page and refresh. Odd way of detecting a change in a page other than lastModified. This just proves how browsers are so arrogant that they know what they are doing when you tell them to refresh. In this case, it only reinterprets the data if it has changed and gets different results from the first loading and it's "reloading". If they can't get offline pages (the most predictable) right, how they gotten as far as functioning online is now a mystery to me. Ponder that. I've tested this on Win98 IE 5.0. I have noticed that on Win2k and XP, refreshing a page is never enough. Making a change to a script
and refreshing will not tell you the correct line where an error is.
You have to close IE and open the file again for the correct area. What a pain!
<BODY bgcolor="#00ace0" onLoad="d()">
<FORM name="A">
<INPUT type="hidden" name="B">
</FORM>
<SCRIPT>
P=Array("14","15","21","22","26","28","29","37","38","39","57","59")
w=document.body.clientWidth
t=Math.floor((w-260)/105)
v=""
function d()
{
for (i=0; i<t; i++)
{
v+='<TD><IMG src="tn'+P[i]+'.jpg"></TD>'
}
document.A.B.value=v
}
alert(document.A.B.value)
document.write("<TABLE border><TR>"+v+"</TR></TABLE>")
</SCRIPT>
</BODY>
width of the browser window and make images in a table wrap. My formula for t below is get the amount of times an image of 105
width can be displayed in a certain width of the width of the window without scrolling. (the images are actually 100px but I am taking margins and cellspacing into effect as an estimate). And the images are supposed to wrap upon loading. But When the page loads, v returns as nothing (the first value assigned). I originally omitted the FORM part thinking that the values assigned to v in d() would pass on. But they didn't. So when I made the form to get the values passed on and reloaded, v once again returned nothing. But when reloaded, v gets the proper value that was assigned in d(). Why? Strangely, it will keep
showing the proper value from then on when you refresh (but I need it to be right the first time). But it will start at nothing again if you make a change to the page and refresh. Odd way of detecting a change in a page other than lastModified. This just proves how browsers are so arrogant that they know what they are doing when you tell them to refresh. In this case, it only reinterprets the data if it has changed and gets different results from the first loading and it's "reloading". If they can't get offline pages (the most predictable) right, how they gotten as far as functioning online is now a mystery to me. Ponder that. I've tested this on Win98 IE 5.0. I have noticed that on Win2k and XP, refreshing a page is never enough. Making a change to a script
and refreshing will not tell you the correct line where an error is.
You have to close IE and open the file again for the correct area. What a pain!
<BODY bgcolor="#00ace0" onLoad="d()">
<FORM name="A">
<INPUT type="hidden" name="B">
</FORM>
<SCRIPT>
P=Array("14","15","21","22","26","28","29","37","38","39","57","59")
w=document.body.clientWidth
t=Math.floor((w-260)/105)
v=""
function d()
{
for (i=0; i<t; i++)
{
v+='<TD><IMG src="tn'+P[i]+'.jpg"></TD>'
}
document.A.B.value=v
}
alert(document.A.B.value)
document.write("<TABLE border><TR>"+v+"</TR></TABLE>")
</SCRIPT>
</BODY>