I have two pages one html page and one Javascript page index.html and script.js. I want to call the javascript page 3 times to display 3 images.
How would I do this from my html page.
script.js
Code:
<script language="JavaScript">
<!--
/*
Random Image Link Script
By Website Abstraction (http://www.wsabstract.com)
and Java-scripts.net (http://www.java-scripts.net)
*/
function random_imglink(){
var myimages=new Array()
//specify random images below. You can have as many as you wish
myimages[1]="http://flashmajic.com/Google/atomica/atomicasmallicon.jpg"
myimages[2]="http://flashmajic.com/Google/atomica/atomicasmallicon.jpg"
myimages[3]="http://flashmajic.com/Google/atomica/atomicasmallicon.jpg"
//specify corresponding links below
var imagelinks=new Array()
imagelinks[1]="http://www.wsabstract.com"
imagelinks[2]="http://www.dynamicdrive.com"
imagelinks[3]="http://www.java-scripts.net"
var ry=Math.floor(Math.random()*myimages.length)
if (ry==0)
ry=1
document.write('<a href='+'"'+imagelinks[ry]+'"'+'><img src="'+myimages[ry]+'" border=2 hspace=1></a>')
}
random_imglink()
//-->
</script>
index.html
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
?????
How would I call that script 3 times to display 3 random images?
</body>
</html>