/ Published in: JavaScript

The ideal use of this code would be to save the Javascript code as a .js file. Then use the HTML code at the bottom to call it wherever you want on the web page.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<!-- Javascript code begins --> var randomlinks=new Array() randomlinks[0]='<img alt="" src="images/image-01.gif" width="150" height="75">' randomlinks[1]='<img alt="" src="images/image-02.gif" width="150" height="75">' randomlinks[2]='<img alt="" src="images/image-03.gif" width="150" height="75">' function randomlink(){ var add = randomlinks[Math.floor(Math.random()*randomlinks.length)] return(add) } document.write( randomlink() ); <!-- Javascript code ends --> <!-- HTML code to use script --> <script type="text/javascript" src="path/to/script.js"></script>
Comments
