Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to add links to a java slider?

Status
Not open for further replies.

mountreal

Technical User
Dec 30, 2007
1
CA
hey everyone! I'm lookin' for some help with this slider code. I need to add links to the images that would appear on that slider. the slider is edited with a content management system though and I have no way to indicate what page should u be redirected if you click on the image that appears..can anyone help me out with this? gracias!!

code location: [URL unfurl="true"]http://www.montrealhiphop.net/1/ [/url]

here's the code:
Code:
<script type="text/javascript">
					var j = {SLIDE_COUNT};
					var i = j;
					
					NewImg = new Array();
					NewText = new Array()
					NewLink = new Array();
					<!-- BEGIN slides -->
					{slides.NEW_IMG_ARRAY}
					{slides.NEW_TEXT_ARRAY}
					{slides.NEW_LINK_ARRAY}
					<!-- END slides -->
					
					document.getElementById("image").style.backgroundImage = "url(" + NewImg[0] + ")"; 
					document.getElementById("topspace").onclick = "window.location.href='" + NewLink[0] + "'";
					document.getElementById("showtext").innerHTML = NewText[0];
					
					
					//Populate the Slide Show numbers for however many slides are brought in from slide table, limit 6 only!
					var koutput = "";
					var m = j + 1; //m = slide number + 1 since arary starts at 0
					var divwrapoff = "<li id='slidenavnumbersoff' style='text-decoration:none;'>";
					var divwrapon = "<li id='slidenavnumberson' style='text-decoration:underline;'>";
					var divwrapend = "</li>";
					
					koutput += '<li id="slidenavarrowback"><a style="text-decoration:none;color:#FFFFFF;" href="javascript:chgImg(-1)">Prev</a></li>';
					for (k=1;k<m;k++){
					j = 1;
						if (k != j) {
							koutput += divwrapoff + k + divwrapend; //not the current slide
						}
						else {
							koutput += divwrapon + k + divwrapend; //current slide, highlights blue
						}
						
					}
					koutput += '<li id="slidenavarrowforward"><a style="text-decoration:none;color:#FFFFFF;" href="javascript:chgImg(1)">Next</a></li>';
					document.getElementById("slidenavnumbers").innerHTML = koutput;
					
					//Variables and Function to change slides automatically or when the user presses the forward or backward buttons
					var ImgNum = 0;
					var ImgLength = NewImg.length - 1;
					var TextNum = 0;
					var TextLength = NewText.length - 1;
					var delay = 3000;
					var lock = false;
					var run;
					run = setInterval("chgImg(1)", delay);
					
					function chgImg(direction) {
						if (document.images) {
							ImgNum = ImgNum + direction;
								if (ImgNum > ImgLength) {
									ImgNum = 0;
								}
								if (ImgNum < 0) {
									ImgNum = ImgLength;
								}
							document.getElementById("topspace").onclick = "window.location.href='" + NewLink[img]um[/img] + "'";
							document.getElementById("image").style.backgroundImage = "url(" + NewImg[img]um[/img] + ")"; 
						}
						
						TextNum = TextNum + direction;
						if (TextNum > TextLength) {
							TextNum = 0;
						}
						if (TextNum < 0) {
							TextNum = TextLength;
						}
						
						document.getElementById("showtext").innerHTML = NewText[TextNum];
					
						koutput = "";
						koutput += '<li id="slidenavarrowback"><a style="text-decoration:none;color:#FFFFFF;" href="javascript:chgImg(-1)">Prev</a></li>';
						for (k=1;k<m;k++){
							var n = TextNum + 1;
								if (k != n) {
									koutput += divwrapoff + k + divwrapend;
								}
								else {
									koutput += divwrapon + k + divwrapend;
								}
						}
						koutput += '<li id="slidenavarrowforward"><a style="text-decoration:none;color:#FFFFFF;" href="javascript:chgImg(1)">Next</a></li>';
						document.getElementById("slidenavnumbers").innerHTML = koutput;
						koutput = "";
					}
					</script>
 
I'm lookin' for some help with this slider code.

What have you done so far to accomplish this, or do you want to hire someone to do it for you?

Lee
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top