Macman
10-06-2003, 05:24 PM
Seems that I overlooked the fact that I had a image rotator javascript on the same html page as the page that I added the marquee to. I observed the fact that the stops and starts of the marquee are exactly time to the image change. Now the question seems to be how do I make them coexist without this problem?
I discovered it by accident when I checked the same marquee on a page that didn't have the image rotator.
Now this takes me to another question. I use a pop-up at special times of the year and I remembered that I had a conflict between the pop up and image rotator script. The pop-up worked but the image rotator did not. How do I make both work?
I know I saw somewhere an answer to this that had to do with having two onload functions and how to get them both to work properly, but I can't seem to find the information in my javascript notes.
This is the pop-up script that I am using but I don't remember having the onload in the body tag it was in the head.
<html>
<head>
<!-- Start Special Announcement Pop-Up Window Code -->
<script type="text/javascript" language="JavaScript">
<!--
function run_popup() {
//
window.open('URL.com/lingerie.html', '_blank', 'width=650,height=425,scrollbars=no,status=no');
}
onload=run_popup;
//-->
</script>
<!-- End Special Announcement Pop-Up Window Code -->
</head>
<body bgcolor="#660033">
</body>
</html>
Now here is the image rotator script:
</STYLE>
<SCRIPT LANGUAGE="JavaScript">
<!-- Original: Robert Bui (astrogate@hotmail.com) -->
<!-- Web Site: http://astrogate.virtualave.net -->
<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->
<!-- Begin
var interval=1.5; // delay between rotating images (in seconds)
var random_display = 1; // 0 = no, 1 = yes
interval *= 1800;
var image_index = 0;
image_list = new Array();
image_list[image_index++] = new imageItem("images/ban50.jpg");
image_list[image_index++] = new imageItem("images/ban245.jpg");
image_list[image_index++] = new imageItem("images/ban43.jpg");
image_list[image_index++] = new imageItem("images/ban400.jpg");
image_list[image_index++] = new imageItem("images/ban147.jpg");
var number_of_image = image_list.length;
function imageItem(image_location) {
this.image_item = new Image();
this.image_item.src = image_location;
}
function get_ImageItemLocation(imageObj) {
return(imageObj.image_item.src)
}
function generate(x, y) {
var range = y - x + 1;
return Math.floor(Math.random() * range) + x;
}
function getNextImage() {
if (random_display) {
image_index = generate(0, number_of_image-1);
}
else {
image_index = (image_index+1) % number_of_image;
}
var new_image = get_ImageItemLocation(image_list[image_index]);
return(new_image);
}
function rotateImage(place) {
var new_image = getNextImage();
document[place].src=new_image;
var recur_call = "rotateImage('"+place+"')";
setTimeout(recur_call, interval);
}
// End -->
</script>
body OnLoad="rotateImage('rImage')"
<img name="rImage" src="images/image-cycler/01.jpg" Border=0 Width="550" Height="350">
Can anyone give me a clue as to how I can make both work?
Now the last question is how do I specify in the pop-up the size of the window for Netscape since when I used this the window is to large in Netscape. I want it to be the same size in both IE and Netscape.
Macman
:confused:
I discovered it by accident when I checked the same marquee on a page that didn't have the image rotator.
Now this takes me to another question. I use a pop-up at special times of the year and I remembered that I had a conflict between the pop up and image rotator script. The pop-up worked but the image rotator did not. How do I make both work?
I know I saw somewhere an answer to this that had to do with having two onload functions and how to get them both to work properly, but I can't seem to find the information in my javascript notes.
This is the pop-up script that I am using but I don't remember having the onload in the body tag it was in the head.
<html>
<head>
<!-- Start Special Announcement Pop-Up Window Code -->
<script type="text/javascript" language="JavaScript">
<!--
function run_popup() {
//
window.open('URL.com/lingerie.html', '_blank', 'width=650,height=425,scrollbars=no,status=no');
}
onload=run_popup;
//-->
</script>
<!-- End Special Announcement Pop-Up Window Code -->
</head>
<body bgcolor="#660033">
</body>
</html>
Now here is the image rotator script:
</STYLE>
<SCRIPT LANGUAGE="JavaScript">
<!-- Original: Robert Bui (astrogate@hotmail.com) -->
<!-- Web Site: http://astrogate.virtualave.net -->
<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->
<!-- Begin
var interval=1.5; // delay between rotating images (in seconds)
var random_display = 1; // 0 = no, 1 = yes
interval *= 1800;
var image_index = 0;
image_list = new Array();
image_list[image_index++] = new imageItem("images/ban50.jpg");
image_list[image_index++] = new imageItem("images/ban245.jpg");
image_list[image_index++] = new imageItem("images/ban43.jpg");
image_list[image_index++] = new imageItem("images/ban400.jpg");
image_list[image_index++] = new imageItem("images/ban147.jpg");
var number_of_image = image_list.length;
function imageItem(image_location) {
this.image_item = new Image();
this.image_item.src = image_location;
}
function get_ImageItemLocation(imageObj) {
return(imageObj.image_item.src)
}
function generate(x, y) {
var range = y - x + 1;
return Math.floor(Math.random() * range) + x;
}
function getNextImage() {
if (random_display) {
image_index = generate(0, number_of_image-1);
}
else {
image_index = (image_index+1) % number_of_image;
}
var new_image = get_ImageItemLocation(image_list[image_index]);
return(new_image);
}
function rotateImage(place) {
var new_image = getNextImage();
document[place].src=new_image;
var recur_call = "rotateImage('"+place+"')";
setTimeout(recur_call, interval);
}
// End -->
</script>
body OnLoad="rotateImage('rImage')"
<img name="rImage" src="images/image-cycler/01.jpg" Border=0 Width="550" Height="350">
Can anyone give me a clue as to how I can make both work?
Now the last question is how do I specify in the pop-up the size of the window for Netscape since when I used this the window is to large in Netscape. I want it to be the same size in both IE and Netscape.
Macman
:confused: