Hi Guys,
I am trying to figure out how to do a server ASP.NET MVC Image Load on Refresh. Basically, I have an array of image's I would like to rotate on refresh on the page. I know how to do this in jQuery but the problem is that all images load at the same time [which sucks in terms of performance]
Does anyone know how I could do this ?
Currently JS looks like below but I really want it server-side:
function random_imglink(){
var myimages=new Array()
//specify random images below. You can have as many as you wish
myimages[1]="img1.gif"
myimages[2]="img2.gif"
myimages[3]="img3.gif"
//specify corresponding links below
var imagelinks=new Array()
imagelinks[1]="http://www.example1.com/"
imagelinks[2]="http://www.example2.com"
imagelinks[3]="http://www.example3.com"
var ry=Math.floor(Math.random()*myimages.length)
if (ry==0)
ry=1
document.write('<a href='+'"'+imagelinks[ry]+'"'+'><img src="'+myimages[ry]+'" border=0></a>')
}
random_imglink()
Thx