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
Old 12-11-2010, 12:39 PM JS help
Junior Talker

Posts: 1
Name: Jinjer
Trades: 0
is it possible to put a link to my rotating backround image?
below is the exact JS script

What do i need to do to put a link to the each images
and the link changes every time it changes also.


-----------------------------------------------

Code:
var s5_current_gc_bg = 1;
var s5imgdiv = "s5_body_wrap";

window.addEvent('domready', function(){
	s5_display_time();
});

function s5_display_time() {
window.setTimeout('s5_load_fade_out()',(s5_bg_tween*1000));
}
 
function s5_load_fade_out() {
$(s5imgdiv).fx = $(s5imgdiv).effect('opacity', {duration: 800}).start(0);
window.setTimeout('s5_change_img()',900);
}

function s5_load_fade_in() {
$(s5imgdiv).fx = $(s5imgdiv).effect('opacity', {duration: 800}).start(1);
window.setTimeout('s5_display_time()',(s5_bg_tween*1000));
}

function s5_change_img() {

if (s5_current_gc_bg == "1") {
	document.getElementById("s5_body_wrap").style.backgroundImage = "url(" + s5_bg_img_2 + ")";
	s5_current_gc_bg = 2;
}

else if (s5_current_gc_bg == "2") {
	if (s5_bg_images == "2") {
		document.getElementById("s5_body_wrap").style.backgroundImage = "url(" + s5_bg_img_1 + ")";
		s5_current_gc_bg = 1;
	}
	if (s5_bg_images > "2") {
		document.getElementById("s5_body_wrap").style.backgroundImage = "url(" + s5_bg_img_3 + ")";
		s5_current_gc_bg = 3;
	}
}

else if (s5_current_gc_bg == "3") {
	if (s5_bg_images == "3") {
		document.getElementById("s5_body_wrap").style.backgroundImage = "url(" + s5_bg_img_1 + ")";
		s5_current_gc_bg = 1;
	}
	if (s5_bg_images > "3") {
		document.getElementById("s5_body_wrap").style.backgroundImage = "url(" + s5_bg_img_4 + ")";
		s5_current_gc_bg = 4;
	}
}

else if (s5_current_gc_bg == "4") {
	if (s5_bg_images == "4") {
		document.getElementById("s5_body_wrap").style.backgroundImage = "url(" + s5_bg_img_1 + ")";
		s5_current_gc_bg = 1;
	}
	if (s5_bg_images > "4") {
		document.getElementById("s5_body_wrap").style.backgroundImage = "url(" + s5_bg_img_5 + ")";
		s5_current_gc_bg = 5;
	}
}

else if (s5_current_gc_bg == "5") {
	if (s5_bg_images == "5") {
		document.getElementById("s5_body_wrap").style.backgroundImage = "url(" + s5_bg_img_1 + ")";
		s5_current_gc_bg = 1;
	}
	if (s5_bg_images > "5") {
		document.getElementById("s5_body_wrap").style.backgroundImage = "url(" + s5_bg_img_6 + ")";
		s5_current_gc_bg = 6;
	}
}

else if (s5_current_gc_bg == "6") {
	if (s5_bg_images == "6") {
		document.getElementById("s5_body_wrap").style.backgroundImage = "url(" + s5_bg_img_1 + ")";
		s5_current_gc_bg = 1;
	}
	if (s5_bg_images > "6") {
		document.getElementById("s5_body_wrap").style.backgroundImage = "url(" + s5_bg_img_7 + ")";
		s5_current_gc_bg = 7;
	}
}

s5_load_fade_in();

}
----------------------------------------

Last edited by chrishirst; 12-11-2010 at 06:13 PM..
jinjerangel is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 12-12-2010, 08:08 AM Re: JS help
Super Spam Talker

Posts: 879
Name: Paul W
Trades: 0
Put an id eg my_link on the href and change it with document.getElementById('my_link').href="a.new.val ue";In the code above, declare a variable to hold the new value, put var = calculated value in place of each document.getElementById("s5_body_wrap").... line and do that assignment at the end of the function together with the link change.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE


*** New:
Please login or register to view this content. Registration is FREE
PaulW is online now
Reply With Quote
View Public Profile
 
Reply     « Reply to JS help
 

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.09719 seconds with 12 queries