»
EnglishFrenchVietnamese

Print - Random Background Image onLoad - JavaScriptBank.com

Full version: jsB@nk » Background » Random Background Image onLoad
URL: http://www.javascriptbank.com/random-background-image-onload.html

Random Background Image onLoad © JavaScriptBank.comThis JavaScript code sets a random image in the defined image for background everytime page was loaded.

Full version: jsB@nk » Background » Random Background Image onLoad
URL: http://www.javascriptbank.com/random-background-image-onload.html



JavaScript
<script language="javascript">/*     This script downloaded from www.JavaScriptBank.com     Come to view and download over 2000+ free javascript at www.JavaScriptBank.com*/<!-- Original:  Tim Wallace -->today=new Date();jran=today.getTime();var number = 7;var random_number="";var image="";var text_color="";ia=9301;ic=49297;im=233280;jran = (jran*ia+ic) % im;random_number = Math.ceil( (jran/(im*1.0)) *number);// Loads the appropriate image and text color based on random number.if (random_number==1) {text_color="000000";image="../image/logojs.gif";}if (random_number==2) {text_color="000000";image="../image/logocuoi.gif";}if (random_number==3) {text_color="000000";image="../image/logojs.gif";}if (random_number==4) {text_color="000000";image="../image/photo3.jpg";}if (random_number==5) {text_color="000000";image="../image/logojs.gif";}if (random_number==6) {text_color="000000";image="../image/photo5.jpg";}if (random_number==7) {text_color="000000";image="../image/logojs.gif";}// End --></SCRIPT><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


HTML
<SCRIPT LANGUAGE="JavaScript"><!-- Begindocument.open();document.write("<BODY  BACKGROUND='"+image+"' TEXT='"+text_color+"'>");document.write("<CENTER></CENTER>");// End --></SCRIPT><SCRIPT LANGUAGE="JavaScript"><!-- Begindocument.write("<CENTER>Background Image: <FONT SIZE=-1>("+image+")</FONT></CENTER>");// End --></SCRIPT><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->