60、随机图片多图片显示

60、随机图片多图片显示

脚本说明:

把如下代码加入<body>区域中

<TABLE BORDER=0 CELLPADDING=10 WIDTH=30% BGCOLOR=#FF9900>

<TR><TD ALIGN=center>

<SCRIPT LANGUAGE="JavaScript">

<!--

if(navigator.appName == "Microsoft Internet Explorer")

{function draw_Image() //draws an image randomly each time the page reloads

{idx = Math.round(Math.random()*6)+1; //generates a number between 1 to 16

document.write("<IMG SRC = 'image0415/" + idx + ".jpg'>");}

draw_Image(); //draw the image which is going to clone

function user_Input()

{//prompt for a number and convert the number to an integer,

//if it fails to convert nothing will happen

input = parseInt(prompt("How many copies would you like to make this image?",""));

for(i = 0; i < input; i++)

{document.write("<IMG SRC= 'image0415/" + idx + ".jpg'>");}}}

else{window.alert("Sorry, this script requires Microsoft Internet Explorer. It doesn't work with Netscape Navigator or other browsers!");}

-->

</SCRIPT>

</TD></TR><TR><TD VALIGN=botttom ALIGN=center>

<FORM>

<INPUT TYPE=button VALUE=Clone onClick="user_Input();" STYLE="font-weight: bold; color: #FFFFFF; background-color: #0099FF"></FORM></TD></TR></TABLE>

<SCRIPT LANGUAGE="JavaScript"><!--

if(navigator.appName == "Microsoft Internet Explorer")

{function catchKeyCode() //calls when the user press the RETURN key

{if(event.keyCode == 13) user_Input();}}

-->

</SCRIPT>

</TD></TR>

</TABLE>

 

Write a comment

Comments: 0