Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Works in IE but not in firefox
Old 11-10-2009, 09:37 PM Works in IE but not in firefox
Junior Talker

Posts: 1
Name: raaam
Trades: 0
hi! this is my coding to scroll images
it works fine in IE but not in Firefox.. and i hav tried firebug.. it seems as if thr were no errors.. can sumone fig a sol for tis..



var displayTime, speed, wait, banner1, banner2, link1, link2, bannerIndex, bannerLocations, bannerURLs;

function initVar() {
displayTime = 10; // The amount of time each banner will be displayed in seconds.
speed = 5; // The speed at which the banners is moved (1 - 10, anything above 5 is not recommended).
wait = true;

banner1 = window.document.getElementById("banner1");
banner2 = window.document.getElementById("banner2");
link1 = window.document.getElementById("link1");
link2 = window.document.getElementById("link2");

banner1 = document.getElementById("banner1");
banner2 = document.getElementById("banner2");

banner1.style.left = 0;
banner2.style.left = 500;

bannerIndex = 1;

/* Important: In order for this script to work properly, please make sure that the banner graphic and the
URL associated with it have the same index in both, the bannerLocations and bannerURLs arrays.
Duplicate URLs are permitted. */

// Enter the location of the banner graphics in the array below.
bannerLocations =["images/1.jpg","images/2.jpg","images/3.jpg"];

// Enter the URL's to which the banners will link to in the array below.
bannerURLs = ["http://www.internet.com","http://www.jupiterweb.com","http://www.jupitermedia.com"];
}

function moveBanner()
{
if(!wait)
{
banner1.style.left = parseInt(banner1.style.left,10) - (speed * 5);
banner2.style.left = parseInt(banner2.style.left,10) - (speed * 5);
if(parseInt(banner1.style.left,10) <= -500)
{
banner1.style.left = 500;
bannerIndex = (bannerIndex < (bannerLocations.length - 1)) ? ++bannerIndex :0;
banner1.src = bannerLocations[bannerIndex];
link1.href = bannerURLs[bannerIndex];
wait = true;
}
if(parseInt(banner2.style.left,10) <= -500)
{
banner2.style.left = 500;
bannerIndex = (bannerIndex < (bannerLocations.length - 1)) ? ++bannerIndex :0;
banner2.src = bannerLocations[bannerIndex];
link2.href = bannerURLs[bannerIndex];
wait = true;
}

setTimeout(function() {moveBanner();},100);
}
else {
wait = false;
setTimeout(function(){moveBanner();}, displayTime * 200);
}
}
myeworld is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Reply     « Reply to Works in IE but not in firefox
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.28283 seconds with 12 queries