P
Penguiniator
I have a script that writes the body tag and adds a background
image to its containing page. This page is displayed in an
iframe inside a td tag of a table constructed with javascript.
The table row it appears in is mid-way down the table. When the
script executes in the iframe it halts the parent window's
script, casusing the table to stop rendering after the row
containing the iframe.
I have no control over the code of the parent window.
Is this behavior normal for javascript? Is there anything I can
do with my code to compensate for the behavior of code in the
parent window?
My code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html;
charset=utf-8" />
</head>
<script>
var backgr2="images/banner2.gif"
var backgr3="images/banner3.gif"
var backgr4="images/banner4.gif"
var backgr5="images/banner5.gif"
var backgr6="images/banner6.gif"
var backgr7="images/banner7.gif"
var cur=Math.round(7*Math.random())
if (cur<=2)
backgr=backgr2
else if (cur<=3)
backgr=backgr3
else if (cur<=4)
backgr=backgr4
else if (cur<=5)
backgr=backgr5
else if (cur<=6)
backgr=backgr6
else
backgr=backgr7
document.write('<body background="'+backgr+'"
bgcolor="#000000"></body>')
</script>
</html>
image to its containing page. This page is displayed in an
iframe inside a td tag of a table constructed with javascript.
The table row it appears in is mid-way down the table. When the
script executes in the iframe it halts the parent window's
script, casusing the table to stop rendering after the row
containing the iframe.
I have no control over the code of the parent window.
Is this behavior normal for javascript? Is there anything I can
do with my code to compensate for the behavior of code in the
parent window?
My code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html;
charset=utf-8" />
</head>
<script>
var backgr2="images/banner2.gif"
var backgr3="images/banner3.gif"
var backgr4="images/banner4.gif"
var backgr5="images/banner5.gif"
var backgr6="images/banner6.gif"
var backgr7="images/banner7.gif"
var cur=Math.round(7*Math.random())
if (cur<=2)
backgr=backgr2
else if (cur<=3)
backgr=backgr3
else if (cur<=4)
backgr=backgr4
else if (cur<=5)
backgr=backgr5
else if (cur<=6)
backgr=backgr6
else
backgr=backgr7
document.write('<body background="'+backgr+'"
bgcolor="#000000"></body>')
</script>
</html>