471,620 Members | 1,190 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,620 software developers and data experts.

IE window.parent.document.images problem

Hi everyone,

I have a main page:

--------------------------------------------------
<html><head><title>Test</title>
</head><body>

<img id="img_a" name="img_a" src="image_1.png" alt=""><br>

<object width="0" height="0" type="text/html"
data="/cgi-bin/next_img?img_a">
refresh image
</object>

</body></html>
--------------------------------------------------

and a script next_img generating this code:

--------------------------------------------------
<html><head>
<script language="javascript1.2" type="text/javascript">
<!--
function doLoad() {
setTimeout( "refresh()", 15 * 1000 );
}

function refresh() {
window.parent.document.images["img_a"].src = "image_2.png";
window.location.reload( false );
}
//-->
</script>
</head><body onLoad="doLoad()">
</body></html>
--------------------------------------------------

The Script specifies a new image (image_2.png) and the duration (15 sec)
to show the new image. On timeout the script is called again. The main
page may hold more than one image and object.

The Script looks nice on Mozilla Firebird but can't find the images in IE 6.0.
I also tested some variants of refresh() like:

function refresh() {
var image = window.parent.document.getElementById("img_a");
image.src = "image_2.png";
window.location.reload( false );
}

but no success. What's wrong? Any help you could provide would be
greatly appreciated.

Thanks in advance,

Winfried Koenig
Jul 20 '05 #1
1 9866
@SM
Winfried Koenig a ecrit :
Hi everyone,

I have a main page:

--------------------------------------------------
<html><head><title>Test</title>
</head><body>

<img id="img_a" name="img_a" src="image_1.png" alt=""><br>

<object width="0" height="0" type="text/html"
data="/cgi-bin/next_img?img_a">
refresh image
</object>

</body></html>
--------------------------------------------------

and a script next_img generating this code:

--------------------------------------------------
<html><head>
<script language="javascript1.2" type="text/javascript">
<!--
function doLoad() {
setTimeout( "refresh()", 15 * 1000 );
}

function refresh() {
window.parent.document.images["img_a"].src = "image_2.png";
window.location.reload( false );
}
and trying :
function refresh() {
with(window.parent) { // funny ! why to call window.parent ?
if(document.images) // to awake the array of images
{
document.images.["img_a"].src = "image_2.png";
doLoad(); // if necessary (I don't know)
}
else
alert('your browser not ok');
}
// and I do not understand the utility of next line
window.location.reload( false );
}

perhaps it would be better to preload the new image ?
if(document.images)
{
Img2 = new Image(); Img2.src = "image_2.png";
}
function refresh() {
with(window.parent) {
if(document.images)
{
document.images.["img_a"].src = Img2.src;
}
}
}

//-->
</script>
</head><body onLoad="doLoad()">
</body></html>
--------------------------------------------------

The Script specifies a new image (image_2.png) and the duration (15 sec)
to show the new image. On timeout the script is called again.
??? why to call again ? to see same image ...
'doLoad' opens the image after 15 secondes of waiting
and no more ...
The main
page may hold more than one image and object.
and if this script is in this main page
I think you have not to call the window.parent
The Script looks nice on Mozilla Firebird but can't find the images in IE 6.0.


--
************************************************** ************
Stéphane MORIAUX : mailto:st*********************@wanadoo.fr
Aide aux Pages Perso (images & couleurs, formulaire, CHP, JS)
http://perso.wanadoo.fr/stephanePOINTmoriaux/internet/
************************************************** ************
Jul 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Phillip Parr | last post: by
19 posts views Thread by Darren | last post: by
14 posts views Thread by D. Alvarado | last post: by
1 post views Thread by XIAOLAOHU | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.