Javascript – random image display with links (help)
-
Hello. I have two banner images that I want to load randomly and have links. When I add the links into the code nothing shows up. I’m not surprised because I have zero coding experience.
I have a script that works but I don’t know how to add links to the images. The links I need to add are listed below the script. Any help is appreciated.
<script language=”JavaScript”>
function banner() { } ; b = new banner() ; n = 0
b[n++]= “<img name=randimg src=’wp-content/uploads/2015/04/asba_chesmont_728x90.jpg’ >”
b[n++]= “<img name=randimg src=’wp-content/uploads/2014/09/tampico_leaderboard_728x90.jpg’ >”
i=Math.floor(Math.random() * n) ;
document.write( b[i] )
</script>These are the links to the images:
Apparently I can’t post links in this forum
The topic ‘Javascript – random image display with links (help)’ is closed to new replies.