I’m hoping this has a simple solution. I have a JavaScript code that displays random images on each page load. Each image links to its own page, as you see image1.jpg goes to image_1.html. As for image3.jpg I dont have a page for that image.
I want to leave it blank, and when the image displays randomly I dont want any sort of rollover that indicates that it links somewhere. In the JavaScript code below I have designated the area of the JavaScript that I think needs to be modified to obtain what I’m looking for.
Any tips or suggestion will help. Thank You.
var imagenumber = 1 ;
var randomnumber = Math.random() ;
var rand1 = Math.round( (imagenumber-1) * randomnumber) + 1 ;
images = new Array
images[1] = "assets/image1.jpg"
images[2] = "assets/image2.jpg"
images[3] = "assets/image3.jpg"
images[4] = "assets/image4.jpg"
var image = images[rand1] ;
var linknumber = 1;
var img1 = Math.round( (linknumber-1) * randomnumber) + 1 ;
links = new Array
links[1] = "image_1.html"
links[2] = "image_2.html"
links[3] = "" // <-- what do I place here to NOT have a link?
links[4] = "image_3.html"
links[5] = "image_4.html"
The indication of a link will come from the use of an
<a></a>tag pair around the image, not from the destination of the tag pair’s HREF attribute. Suppressing the link withjavascript:void(0);is a good idea for having the link go nowhere/do nothing, but won’t remove the indication that a link exists…unless the javascript that converts a value from thelinksarray into an image looks for a blank or other value and uses it as a signal to spit out an<img>tag without a surrounding<a></a>tag pair.So, look through your code and figure out where the actual HTML is being generated, and see what must be done to trigger a non-link output. If there is no code to make that happen, you’ll need to write it.