gigigo Groupie
加入: 2004/5月/31
Online Status: Offline 回復: 42
|
Posted: 2004/5月/31 10:27上午 | IP記錄
|
|
|
指令碼說明: 第一步:把如下程式碼加入<head>區域中: <SCRIPT LANGUAGE="javascript"> <!-- var a = 21 function create() { this.line = '' } function skrivut(formet) { bild1 = formet.bilden.value; bild2 = formet.bildtva.value; kall1 = formet.srcen.value; kall2 = formet.srctva.value; bildnamn = formet.bildnmn.value; widd = formet.widden.value; hojd = formet.hojden.value;
line = new Array() for(var i=1; i<=a; i++) { line = new create() } line[1] = '<html><head><title>Code Window</title></head><body bgcolor="#FFFFFF">' line[2] = '<HTML><HEAD><br><TITLE>Title of your page</title><P>' line[3] = '<SCRIPT LANGUAGE="javascript"><BR><!--<BR>/**luxia oqing http://*.*.*/*/*.htm--/<BR>Browser = false ;<BR>if(navigator.appName.indexOf("Netscape") != -1)<BR>' line[5] = '{ if( (navigator.appVersion.indexOf("3.") != -1) || (navigator.appVersion.indexOf("4.") != -1) )<BR>' line[6] = ' Browser = true}<BR>' line[7]='if(navigator.appVersion.indexOf("MSIE") != -1) { if( navigator.appVersion.indexOf("4.") != -1)<BR>' line[8]='Browser=true}<BR>' line[9]='if ( Browser == true) {<BR>' line[10] = bild1+'= new Image();<BR>' line[11] = bild1+'.src = "'+kall1+'";<BR>' line[12] = bild2+' = new Image();<BR>' line[13] = bild2+'.src = "'+kall2+'";<BR>}<P>' line[14] = 'function byt(place, imgName) {<BR>' line[15] = 'if (Browser == true) {<BR>' line[16] = 'document[place].src =eval(imgName + ".src");<BR>' line[17] = '} }<BR>' line[18] = '//--><BR>' line[19] = '</SCRIPT><P></HEAD><br><BODY> <P>Here comes the link:<BR>' line[20] = '<A HREF=".html" onMouseOver="byt(''+bildnamn+'',''+bild2+'')" onMouseOut="byt(''+bildnamn+'',''+bild1+'')">' line[21] = '<IMG SRC="'+kall1+'" NAME="'+bildnamn+'" HEIGHT="'+hojd+'" WIDTH="'+widd+'" BORDER="0"></A>' line[22] = '<P></BODY></HTML><P><FORM>< ;INPUT TYPE="button" VALUE="關閉" onClick="self.close()"></FORM></BODY></HTM L>' nyaWin = window.open('','utskrift','toolbar=0,location=0,directories= 0,status=1,menubar=1,scrollbars=1,resizable=0,copyhistory=0, width=600,height=400') nytt () } g = 0 function nytt() { g++ nyaWin.document.writeln(line[g]); if (g < (a+1)) nytt() nyaWin.document.close() g = 0 } Browser = false ; if(navigator.appName.indexOf("Netscape") != -1) { if( (navigator.appVersion.indexOf("3.") != -1) || (navigator.appVersion.indexOf("4.") != -1) ) { Browser = true; fredrik= new Image(); fredrik.src = "knapp1.gif"; sover = new Image(); sover.src = "knapp2.gif"; } } function byt(place, imgName) { if (Browser == true) { document[place].src =eval(imgName + ".src"); } } //--> </SCRIPT>
第二步:把如下程式碼加入<body>區域中: <form> 圖片1的名字: <INPUT TYPE="text" NAME="bilden" class="pt9" value="mouseoutpic"> <BR> 圖片1的路徑: <INPUT TYPE="text" NAME="srcen" class="pt9" value="images/pic1.gif"> <BR> 圖片1的寬度: <INPUT TYPE="text" NAME="widden" class="pt9" value="100"> <BR> 圖片1的高度: <INPUT TYPE="text" NAME="hojden" class="pt9" value="50"> <P> 圖片2的名字: <INPUT TYPE="text" NAME="bildtva" class="pt9" value="mouseoverpic"> <BR> 圖片2的路徑: <INPUT TYPE="text" NAME="srctva" class="pt9" value="images/pic2.gif"> <BR> 操作的名字 : <INPUT TYPE="text" NAME="bildnmn" class="pt9" value="first_pic"> <BR> <INPUT TYPE="BUTTON" VALUE="生成程式碼" onClick="skrivut(this.form)" class="pt9"> </FORM> <P> <P>說明:圖片1==》mouse out時的圖片,正常顯示時。圖片2==》mouse over時的圖片。圖片的名字和操作的名字可以隨便取。有所區別即可。 <P>2個圖片的尺寸必須一致才可以。
|