滚动的背景(见过吗?)一个VBScript脚本,背景是运动的。首先为页 面设一个背景图,然后将这一段代码加入& […]
控制背景颜色变化
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 |
<script language="JavaScript"> var red = 0; var green = 0; var blue = 0; var value = 0; var convert = new Array() var hexbase = new Array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F"); for (x = 0; x < 16; x++) { for (y = 0; y < 16; y++) { convert[value] = hexbase[x] + hexbase[y]; value++; } } function clear() { document.color.bl.value = blue; document.color.rd.value = red; document.color.gr.value = green; } function display() { redx = convert[red] greenx = convert[green] bluex = convert[blue] var rgb = "#" + redx + greenx + bluex; document.color.rgbdspl.value = rgb; document.bgColor = rgb; } function upred(x) { if ((red + x) <= 255) red += x document.color.rd.value = red; display() } function downred(x) { if ((red - x) >= 0) red -= x document.color.rd.value = red; display() } function upgreen(x) { if ((green + x) <= 255) green += x document.color.gr.value = green; display() } function downgreen(x) { if ((green - x) >= 0) green -= x document.color.gr.value = green; display() } function upblue(x) { if ((blue + x) <= 255) blue += x document.color.bl.value = blue; display() } function downblue(x) { if ((blue - x) >= 0) blue -= x document.color.bl.value = blue; display() } </script> <form name="color"> <table align="center"> <tr align="Center"> <td width="52"> <input name="red" type="button" value=" +50 " onclick="upred(50)"> </td> <td width="58"> <input name="red2" type="button" value=" + 10 " onclick="upred(10)"> </td> <td width="46"> <input name="red2" type="button" value=" + 1" onclick="upred(1)"> </td> <td width="52"> <font color="#FF0000" size='+3'><b><font color="#FA0000" face="楷体_GB2312">红</font></b></font> </td> <td width="46"> <input name="red-" type="button" value=" - 1" onclick="downred(1)"> </td> <td width="58"> <input name="red-" type="button" value=" - 10 " onclick="downred(10)"> </td> <td width="52"> <input name="red-" type="button" value=" -50 " onclick="downred(50)"> </td> <td width="29"> <input type="text" name="rd" size='3'> </td> </tr> <tr align="Center"> </table> <td width="52"> <input name="green" type="button" value=" +50 " onclick="upgreen(50)"> </td> <td width="58"> <input name="green" type="button" value=" + 10 " onclick="upgreen(10)"> </td> <td width="46"> <input name="green" type="button" value=" + 1" onclick="upgreen(1)"> </td> <td width="52"> <font color="#00FF00" size='+3'><b><font color="#00FA00" face="楷体_GB2312">绿</font></b></font> </td> <td width="46"> <input name="green-" type="button" value=" - 1" onclick="downgreen(1)"> </td> <td width="58"> <input name="green-" type="button" value=" - 10 " onclick="downgreen(10)"> </td> <td width="52"> <input name="green-" type="button" value=" -50 " onclick="downgreen(50)"> </td> <td width="29"> <input type="text" name="gr" size='3'> </td> </tr> </table> </form> |
弹出窗口
<script LANGUAGE=”javascript”> <!& […]
五彩闪烁字
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
<script type="text/javascript"> var rate = 20; var obj; var act = 0; var elmH = 0; var elmS = 128; var elmV = 255; var clrOrg; var TimerID; if (navigator.appName.indexOf("Microsoft", 0) != -1 && parseInt(navigator.appVersion) >= 4) { Browser = true; } else { Browser = false; } if (Browser) { document.onmouseover = doRainbowAnchor; document.onmouseout = stopRainbowAnchor; } function doRainbow() { if (Browser && act != 1) { act = 1; obj = event.srcElement; clrOrg = obj.style.color; TimerID = setInterval("ChangeColor()", 100); } } function stopRainbow() { if (Browser && act != 0) { obj.style.color = clrOrg; clearInterval(TimerID); act = 0; } } function doRainbowAnchor() { if (Browser && act != 1) { obj = event.srcElement; while (obj.tagName != 'A' && obj.tagName != 'BODY') { obj = obj.parentElement; if (obj.tagName == 'A' || obj.tagName == 'BODY') break; } if (obj.tagName == 'A' && obj.href != '') { act = 1; clrOrg = obj.style.color; TimerID = setInterval("ChangeColor()", 100); } } } function stopRainbowAnchor() { if (Browser && act != 0) { if (obj.tagName == 'A') { obj.style.color = clrOrg; clearInterval(TimerID); act = 0; } } } function ChangeColor() { obj.style.color = makeColor(); } function makeColor() { if (elmS == 0) { elmR = elmV; elmG = elmV; elmB = elmV; } else { t1 = elmV; t2 = (255 - elmS) * elmV / 255; t3 = elmH % 60; t3 = (t1 - t2) * t3 / 60; if (elmH < 60) { elmR = t1; elmB = t2; elmG = t2 + t3; } else if (elmH < 120) { elmG = t1; elmB = t2; elmR = t1 - t3; } else if (elmH < 180) { elmG = t1; elmR = t2; elmB = t2 + t3; } else if (elmH < 240) { elmB = t1; elmR = t2; elmG = t1 - t3; } else if (elmH < 300) { elmB = t1; elmG = t2; elmR = t2 + t3; } else if (elmH < 360) { elmR = t1; elmG = t2; elmB = t1 - t3; } else { elmR = 0; elmG = 0; elmB = 0; } } elmR = Math.floor(elmR); elmG = Math.floor(elmG); elmB = Math.floor(elmB); clrRGB = '#' + elmR.toString(16) + elmG.toString(16) + elmB.toString(16); elmH = elmH + rate; if (elmH >= 360) elmH = 0; return clrRGB; } </script> <a href="###">开心狗狗乐园</a> |
文字变色
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
<script type="text/javascript"> var message = "闽派企业中国服装品牌年度大奖兵败反思"; var n = 0; if (document.all) { document.write('<font size="15px" color="#0000ff">'); for (m = 0; m < message.length; m++) { document.write('<span id="neonlight" style="font-family:Verdana,Arial;font-size:15px">' + message.charAt(m) + '</span>'); } document.write('</font>'); var tempref = document.all.neonlight; } else { document.write(message); } function neon() { if (n == 0) { for (m = 0; m < message.length; m++) { tempref[m].style.color = "#ff0099" } } tempref[n].style.color = "#9900CC"; if (n < tempref.length - 1) { n++; } else { n = 0; clearInterval(flashing); setTimeout("beginneon()", 1500); return; } } function beginneon() { if (document.all) { flashing = setInterval("neon()", 100); } } beginneon(); </script> |
跟随鼠标biubiu
<script> <!– //– GRANTEE —&# […]
围绕鼠标转动的文字
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
<html> <head> <title> 围绕鼠标转动的文字 </title> <script language=JavaScript> //IE专用 //Logo orbit II kurt.grigg@virgin.net yourLogo = '欢迎来到无忧视窗'; logoFont = 'Arial'; logoSize = 9; logoColor = 'red'; logoWidth = 40; logoHeight = 40; logoSpeed = 0.03; //Nothing needs altering below! yourLogo = yourLogo.split(''); L = yourLogo.length; Result = "<font face=" + logoFont + " style='font-size:" + logoSize + "pt' color=" + logoColor + ">"; TrigSplit = 360 / L; br = (document.layers) ? 1 : 0; if (br) { for (i = 0; i < L; i++) document.write('<layer name="ns' + i + '" top=0 left=0 width=14 height=14">' + Result + yourLogo[i] + '</font></layer>'); } else { document.write('<div id="outer" style="position:absolute;top:0px;left:0px"><div style="position:relative">'); for (i = 0; i < L; i++) document.write('<div id="ie" style="position:absolute;top:0px;left:0px;width:14px;height:14px">' + Result + yourLogo[i] + '</font></div>'); document.write('</div></div>'); } ypos = 0; xpos = 0; step = logoSpeed; currStep = 0; Y = new Array(); X = new Array(); Yn = new Array(); Xn = new Array(); for (i = 0; i < L; i++) { Yn[i] = 0; Xn[i] = 0; }(document.layers) ? window.captureEvents(Event.MOUSEMOVE) : 0; function Mouse(evnt) { ee = evnt||event; ypos = (document.layers) ? evnt.pageY : ee.y; xpos = (document.layers) ? evnt.pageX : ee.x; }(document.layers) ? window.onMouseMove = Mouse : document.onmousemove = Mouse; function animateLogo() { if (!br) outer.style.pixelTop = document.body.scrollTop; for (i = 0; i < L; i++) { var layer = (document.layers) ? document.layers['ns' + i] : ie[i].style; layer.top = Y[i] + logoHeight * Math.sin(currStep + i * TrigSplit * Math.PI / 180); layer.left = X[i] + logoWidth * Math.cos(currStep + i * TrigSplit * Math.PI / 180); } currStep -= step; } function Delay() { for (i = L; i >= 0; i--) { Y[i] = Yn[i] += (ypos - Yn[i]) * (0.1 + i / L); X[i] = Xn[i] += (xpos - Xn[i]) * (0.1 + i / L); } animateLogo(); setTimeout('Delay()', 20); } window.onload = Delay; </script> <meta http-equiv=Content-Type content="text/html; charset=gb2312"> <meta content="MSHTML 6.00.2900.2912" name=GENERATOR> <meta content=FrontPage.Editor.Document name=ProgId> <style> <!-- body, td, div { font-family: Verdana; font-size: 9pt } --> </style> </head> <body> </body> </html> |
跟随鼠标的萤火虫
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
<script language="JavaScript"> if (!document.layers && !document.all) event = "test"; function showtip2(current, e, text) { if (document.all && document.readyState == "complete") { document.all.tooltip2.innerHTML = '<marquee style="border:1px solid black">' + text + '</marquee>' document.all.tooltip2.style.pixelLeft = event.clientX + document.body.scrollLeft + 10; document.all.tooltip2.style.pixelTop = event.clientY + document.body.scrollTop + 10; document.all.tooltip2.style.visibility = "visible"; } else if (document.layers) { document.tooltip2.document.nstip.document.write('<b>' + text + '</b>'); document.tooltip2.document.nstip.document.close(); document.tooltip2.document.nstip.left = 0; currentscroll = setInterval("scrolltip()", 100); document.tooltip2.left = e.pageX + 10; document.tooltip2.top = e.pageY + 10; document.tooltip2.visibility = "show"; } } function hidetip2() { if (document.all) document.all.tooltip2.style.visibility = "hidden"; else if (document.layers) { clearInterval(currentscroll); document.tooltip2.visibility = "hidden"; } } function scrolltip() { if (document.tooltip2.document.nstip.left >= -document.tooltip2.document.nstip.document.width) document.tooltip2.document.nstip.left -= 5; else document.tooltip2.document.nstip.left = 150; } function YY_Layerfx(yyleft, yytop, yyfnx, yyfny, yydiv, yybilder, yyloop, yyto, yycnt, yystep) { //v1.2 if ((document.layers) || (document.all)) { with(Math) { yynextx = eval(yyfnx) } with(Math) { yynexty = eval(yyfny) } yycnt = (yyloop && yycnt >= yystep * yybilder) ? 0 : yycnt + yystep; if (document.layers) { eval(yydiv + ".top=" + (yynexty + yytop)); eval(yydiv + ".left=" + (yynextx + yyleft)); } if (document.all) { eval("yydiv=yydiv.replace(/.layers/gi, '.all')"); eval(yydiv + ".style.pixelTop=" + (yynexty + yytop)); eval(yydiv + ".style.pixelLeft=" + (yynextx + yyleft)); } argStr = 'YY_Layerfx(' + yyleft + ',' + yytop + ',"' + yyfnx + '","' + yyfny + '","' + yydiv + '",' + yybilder + ',' + yyloop + ',' + yyto + ',' + yycnt + ',' + yystep + ')'; if (yycnt <= yystep * yybilder) { eval(yydiv + ".yyto=setTimeout(argStr,yyto)"); } } } function YY_Mousetrace(evnt) { if (yyns4) { if (evnt.pageX) { yy_ml = evnt.pageX; yy_mt = evnt.pageY; } } else { yy_ml = (event.clientX + document.body.scrollLeft); yy_mt = (event.clientY + document.body.scrollTop); } if (yy_tracescript) eval(yy_tracescript) } function PopWin() { var PopWin = window.open("new.htm", "PopWin", "toolbar=no,directries=no,scrollBars=yes,height=350,width=400"); } </script> <body> <div id="tooltip2" style="position:absolute;visibility:hidden;clip:rect(0 150 50 0);width:150px;background-color:lightyellow"> <layer name="nstip" width="1000px" bgColor="lightyellow"> </layer> </div> <div id="yyd0" style="position:absolute; left:10px; top:50px; width:3px; height:3px; z-index:1; background-color: #19636c; layer-background-color: #19636c; border: 1px none #000000; clip: rect(0 3 3 0)"> </div> <div id="yyd1" style="position:absolute; left:20px; top:50px; width:3px; height:3px; z-index:1; background-color: #708574; layer-background-color: #708574; border: 1px none #000000; clip: rect(0 3 3 0)"> </div> <div id="yyd2" style="position:absolute; left:30px; top:50px; width:3px; height:3px; z-index:1; background-color: #379bbf; layer-background-color: #379bbf; border: 1px none #000000; clip: rect(0 3 3 0)"> </div> <div id="yyd3" style="position:absolute; left:40px; top:50px; width:3px; height:3px; z-index:1; background-color: #25184c; layer-background-color: #25184c; border: 1px none #000000; clip: rect(0 3 3 0)"> </div> <div id="yyd4" style="position:absolute; left:50px; top:50px; width:3px; height:3px; z-index:1; background-color: #31bd3c; layer-background-color: #31bd3c; border: 1px none #000000; clip: rect(0 3 3 0)"> </div> <div id="yyd5" style="position:absolute; left:60px; top:50px; width:3px; height:3px; z-index:1; background-color: #c11efd; layer-background-color: #c11efd; border: 1px none #000000; clip: rect(0 3 3 0)"> </div> <script> var yyns4 = window.Event ? true : false; var yy_mt = 0; var yy_ml = 0; document.onmousemove = YY_Mousetrace; yy_tracescript = ''; if (yyns4) { document.captureEvents(Event.mousemove); YY_Mousetrace('', ',document.YY_Mousetrace1') } YY_Layerfx(0, 0, 'yy_ml+cos((15*sin(yycnt/39.83007847812662))+0)*150*(sin(10+yycnt/20)+0.2)*cos(yycnt/20)', 'yy_mt+sin((15*sin(yycnt/34.224861639800686))+0)*150*(sin(10+yycnt/20)+0.2)*cos(yycnt/20)', 'document.layers["yyd0"]', 2000, true, 80, 0, 1); YY_Layerfx(0, 0, 'yy_ml+cos((15*sin(yycnt/27.66510707209673))+30)*150*(sin(10+yycnt/20)+0.2)*cos(yycnt/20)', 'yy_mt+sin((15*sin(yycnt/9.240632767417667))+30)*150*(sin(10+yycnt/20)+0.2)*cos(yycnt/20)', 'document.layers["yyd1"]', 2000, true, 80, 0, 1); YY_Layerfx(0, 0, 'yy_ml+cos((15*sin(yycnt/16.45318944579641))+60)*150*(sin(10+yycnt/20)+0.2)*cos(yycnt/20)', 'yy_mt+sin((15*sin(yycnt/16.0564452288292))+60)*150*(sin(10+yycnt/20)+0.2)*cos(yycnt/20)', 'document.layers["yyd2"]', 2000, true, 80, 0, 1); YY_Layerfx(0, 0, 'yy_ml+cos((15*sin(yycnt/6.95348954836835))+90)*150*(sin(10+yycnt/20)+0.2)*cos(yycnt/20)', 'yy_mt+sin((15*sin(yycnt/44.13697049887155))+90)*150*(sin(10+yycnt/20)+0.2)*cos(yycnt/20)', 'document.layers["yyd3"]', 2000, true, 80, 0, 1); YY_Layerfx(0, 0, 'yy_ml+cos((15*sin(yycnt/33.90077294583733))+120)*150*(sin(10+yycnt/20)+0.2)*cos(yycnt/20)', 'yy_mt+sin((15*sin(yycnt/2.2378828869411587))+120)*150*(sin(10+yycnt/20)+0.2)*cos(yycnt/20)', 'document.layers["yyd4"]', 2000, true, 80, 0, 1); YY_Layerfx(0, 0, 'yy_ml+cos((15*sin(yycnt/37.858312521039835))+150)*150*(sin(10+yycnt/20)+0.2)*cos(yycnt/20)', 'yy_mt+sin((15*sin(yycnt/18.083839795990098))+150)*150*(sin(10+yycnt/20)+0.2)*cos(yycnt/20)', 'document.layers["yyd5"]', 2000, true, 80, 0, 1); </script> </body> |
鼠标跟随的文字
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
<head> <style type="text/css"> .spanstyle { position:absolute; visibility:visible; top:-50px; font-size:9pt; color: #0000FF; font-weight:bold; } </style> <script type="text/javascript"> //IE专用 var x, y var step = 20 var flag = 0 var message = "欢迎来枫丹白露亭!!" message = message.split(""); var xpos = new Array(); for (i = 0; i <= message.length - 1; i++) { xpos[i] = -50 } var ypos = new Array(); for (i = 0; i <= message.length - 1; i++) { ypos[i] = -50 } function handlerMM(e) { ee=e||event; x = (document.layers) ? e.pageX : document.body.scrollLeft + ee.clientX; y = (document.layers) ? e.pageY : document.body.scrollTop + ee.clientY; flag = 1; } function makesnake() { if (flag == 1 && document.all) { for (i = message.length - 1; i >= 1; i--) { xpos[i] = xpos[i - 1] + step; ypos[i] = ypos[i - 1] } xpos[0] = x + step; ypos[0] = y for (i = 0; i < message.length - 1; i++) { var thisspan = eval("span" + (i) + ".style"); thisspan.posLeft = xpos[i]; thisspan.posTop = ypos[i]; } } else if (flag == 1 && document.layers) { for (i = message.length - 1; i >= 1; i--) { xpos[i] = xpos[i - 1] + step; ypos[i] = ypos[i - 1]; } xpos[0] = x + step; ypos[0] = y; for (i = 0; i < message.length - 1; i++) { var thisspan = eval("document.span" + i); thisspan.left = xpos[i]; thisspan.top = ypos[i]; } } var timer = setTimeout("makesnake()", 30); } </script> </head> <body onload="makesnake()"> <script type="text/javascript"> for (i = 0; i <= message.length - 1; i++) { document.write("<span id='span" + i + "' class='spanstyle'>"); document.write(message[i]); document.write("</span>"); } if (document.layers) { document.captureEvents(Event.MOUSEMOVE); } document.onmousemove = handlerMM; </script> </body> |
跟随文字
[code] ? ?<style type=”text/css”> ? ? […]
跟随鼠标的图片
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
<head> <script type="text/javascript"> //IE专用 var newtop = 0 var newleft = 0 if (navigator.appName == "Netscape") { layerStyleRef = "layer."; layerRef = "document.layers"; styleSwitch = ""; } else { layerStyleRef = "layer.style."; layerRef = "document.all"; styleSwitch = ".style"; } function doMouseMove() { layerName = 'iit'; eval('var curElement=' + layerRef + '["' + layerName + '"]'); eval(layerRef + '["' + layerName + '"]' + styleSwitch + '.visibility="hidden"'); eval('curElement' + styleSwitch + '.visibility="visible"'); eval('newleft=document.body.clientWidth-curElement' + styleSwitch + '.pixelWidth'); eval('newtop=document.body.clientHeight-curElement' + styleSwitch + '.pixelHeight'); eval('height=curElement' + styleSwitch + '.height'); eval('width=curElement' + styleSwitch + '.width'); width = parseInt(width); height = parseInt(height); if (event.clientX > (document.body.clientWidth - 5 - width)) { newleft = document.body.clientWidth + document.body.scrollLeft - 5 - width } else { newleft = document.body.scrollLeft + event.clientX } eval('curElement' + styleSwitch + '.pixelLeft=newleft'); if (event.clientY > (document.body.clientHeight - 5 - height)) { newtop = document.body.clientHeight + document.body.scrollTop - 5 - height; } else { newtop = document.body.scrollTop + event.clientY; } eval('curElement' + styleSwitch + '.pixelTop=newtop'); } document.onmousemove = doMouseMove; </script> </head> <body> <script type="text/javascript"> if (navigator.appName == "Netscape") {} else { document.write('<div ID=OuterDiv>'); document.write('<img ID=iit src="smile.gif" STYLE="position:absolute;TOP:5pt;LEFT:5pt;Z-INDEX:10;visibility:hidden;">'); document.write('</div > '); } </script> </body> |
登陆密码键盘
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 |
<tr> <td align="left"> 密 码: <input name="PassWord" type="text" size="20" onMouseOut="this.style.background='#F9F9F9'" onFocus="this.select();" readOnly onKeyDown="Calc.password.value=this.value" onChange="Calc.password.value=this.value" onclick="password1=this;showkeyboard();this.readOnly=1;Calc.password.value=''"> </td> </tr> <script type="text/javascript"> //定义当前是否大写的状态 window.onload = function () { password1 = null; initCalc(); } var CapsLockValue = 0; var check; function setVariables() { tablewidth = 630; // logo width, in pixels tableheight = 20; // logo height, in pixels if (navigator.appName == "Netscape") { horz = ".left"; vert = ".top"; docStyle = "document."; styleDoc = ""; innerW = "window.innerWidth"; innerH = "window.innerHeight"; offsetX = "window.pageXOffset"; offsetY = "window.pageYOffset"; } else { horz = ".pixelLeft"; vert = ".pixelTop"; docStyle = ""; styleDoc = ".style"; innerW = "document.body.clientWidth"; innerH = "document.body.clientHeight"; offsetX = "document.body.scrollLeft"; offsetY = "document.body.scrollTop"; } } function checkLocation() { if (check) { objectXY = "softkeyboard"; var availableX = eval(innerW); var availableY = eval(innerH); var currentX = eval(offsetX); var currentY = eval(offsetY); x = availableX - tablewidth + currentX; //y=availableY-tableheight+currentY; y = currentY; evalMove(); } setTimeout("checkLocation()", 0); } function evalMove() { //eval(docStyle + objectXY + styleDoc + horz + "=" + x); eval(docStyle + objectXY + styleDoc + vert + "=" + y); } self.onError = null; currentX = currentY = 0; whichIt = null; lastScrollX = 0; lastScrollY = 0; NS = (document.layers) ? 1 : 0; IE = (document.all) ? 1 : 0; function heartBeat() { if (IE) { diffY = document.body.scrollTop; diffX = document.body.scrollLeft; } if (NS) { diffY = self.pageYOffset; diffX = self.pageXOffset; } if (diffY != lastScrollY) { percent = .1 * (diffY - lastScrollY); if (percent > 0) percent = Math.ceil(percent); else percent = Math.floor(percent); if (IE) document.all.softkeyboard.style.pixelTop += percent; if (NS) document.softkeyboard.top += percent; lastScrollY = lastScrollY + percent; } if (diffX != lastScrollX) { percent = .1 * (diffX - lastScrollX); if (percent > 0) percent = Math.ceil(percent); else percent = Math.floor(percent); if (IE) document.all.softkeyboard.style.pixelLeft += percent; if (NS) document.softkeyboard.left += percent; lastScrollX = lastScrollX + percent; } } function checkFocus(x, y) { stalkerx = document.softkeyboard.pageX; stalkery = document.softkeyboard.pageY; stalkerwidth = document.softkeyboard.clip.width; stalkerheight = document.softkeyboard.clip.height; if ((x > stalkerx && x < (stalkerx + stalkerwidth)) && (y > stalkery && y < (stalkery + stalkerheight))) return true; else return false; } function grabIt(e) { check = f alse; if (IE) { whichIt = e vent.srcElement; while (whichIt.id.indexOf("softkeyboard") == -1) { whichIt = w hichIt.parentElement; if (whichIt == n ull) { return true; } } whichIt.style.pixelLeft = w hichIt.offsetLeft; whichIt.style.pixelTop = w hichIt.offsetTop; currentX = (event.clientX + document.body.scrollLeft); currentY = (event.clientY + document.body.scrollTop); } else { window.captureEvents(Event.MOUSEMOVE); if (checkFocus(e.pageX, e.pageY)) { whichIt = d ocument.softkeyboard; StalkerTouchedX = e.pageX - document.softkeyboard.pageX; StalkerTouchedY = e.pageY - document.softkeyboard.pageY; } } return true; } function moveIt(e) { if (whichIt == n ull) { return false; } if (IE) { newX = (event.clientX + document.body.scrollLeft); newY = (event.clientY + document.body.scrollTop); distanceX = (newX - currentX); distanceY = (newY - currentY); currentX = n ewX; currentY = n ewY; whichIt.style.pixelLeft += d istanceX; whichIt.style.pixelTop += d istanceY; if (whichIt.style.pixelTop < document.body.scrollTop) whichIt.style.pixelTop = d ocument.body.scrollTop; if (whichIt.style.pixelLeft < document.body.scrollLeft) whichIt.style.pixelLeft = d ocument.body.scrollLeft; if (whichIt.style.pixelLeft > document.body.offsetWidth - document.body.scrollLeft - whichIt.style.pixelWidth - 20) whichIt.style.pixelLeft = document.body.offsetWidth - whichIt.style.pixelWidth - 20; if (whichIt.style.pixelTop > document.body.offsetHeight + document.body.scrollTop - whichIt.style.pixelHeight - 5) whichIt.style.pixelTop = document.body.offsetHeight + document.body.scrollTop - whichIt.style.pixelHeight - 5; event.returnValue = false; } else { whichIt.moveTo(e.pageX - StalkerTouchedX, e.pageY - StalkerTouchedY); if (whichIt.left < 0 + self.pageXOffset) whichIt.left = 0 + self.pageXOffset; if (whichIt.top < 0 + self.pageYOffset) whichIt.top = 0 + self.pageYOffset; if ((whichIt.left + whichIt.clip.width) > = (window.innerWidth + self.pageXOffset - 17)) whichIt.left = ((window.innerWidth + self.pageXOffset) - whichIt.clip.width) - 17; if ((whichIt.top + whichIt.clip.height) >= (window.innerHeight + self.pageYOffset - 17)) whichIt.top = ((window.innerHeight + self.pageYOffset) - whichIt.clip.height) - 17; return false; } return false; } function dropIt() { whichIt = null; if (NS) window.releaseEvents(Event.MOUSEMOVE); return true; } if (NS) { window.captureEvents(Event.MOUSEUP | Event.MOUSEDOWN); window.onmousedown = grabIt; window.onmousemove = moveIt; window.onmouseup = dropIt; } if (IE) { document.onmousedown = grabIt; document.onmousemove = moveIt; document.onmouseup = dropIt; } // if(NS || IE) action = window.setInterval("heartBeat()",1); document.write("<div align=center id=\"softkeyboard \" name=\"softkeyboard \" style=\"position: absolute;left: 0px;top: 0px;width: 500px;z - index: 180;display: none \">"+ " <table id=\"CalcTable \" width=\" \" border=\"0 \" align=\"center \" cellpadding=\"0 \" cellspacing=\"0 \" bgcolor=\" \">"+ " <form id=Calc name=Calc action=\" \" method=post autocomplete=\"off \">"+ " <tr>"+ " <td title=\"为了保证后台登陆安全,建议使用密码输入器输入密码!\" align=\"right\"valign = \"middle\" bgcolor=\" \" style=\"cursor: default;height:30 \">"+ " <input type=hidden value=\" \" name=password>"+ " <input type=hidden value=ok name=action2>"+ " ?"+ " <font style=\"font - size: 13px;\">"+ " 新云下载管理系统V6.0.1"+ " </font > 密码输入器 & nbsp & nbsp & nbsp & nbsp & nbsp & nbsp & nbsp & nbsp & nbsp & nbsp < input style = \"width:100px;height:20px;background-color:#54BAF1;\" type=button"+ " value=\"使用键盘输入 \" bgtype=\"1 \" onclick=\"password1.readOnly = 0;password1.focus();softkeyboard.style.display = 'none';password1.value = '';\">"+ " <span style=\"width:2px;\" > </span>"+ " </td > </tr>"+ " <tr align=\"center\" > < td align = \"center\" bgcolor=\"#FFFFFF \">"+ " <table align=\"center \" width=\" % \" border=\"0\" cellspacing = \"1\" cellpadding=\"0 \">"+ " /n"+ " <tr align=\"left \" valign=\"middle \">"+ " /n"+ " <td>"+ " <input type=button value=\"~ \">"+ " </td>"+ " /n"+ " <td>"+ " <input type=button value=\"!\">"+ " </td > /n"+ " <td>"+ " <input type=button value=\" @ \" > </td>"+ " /n <td> <input type = button value = \" # \"> </td>"+ " /n"+ " <td>"+ " <input type=button value=\"$ \">"+ " </td>"+ " /n"+ " <td>"+ " <input type=button value=\" % \">"+ " </td > /n"+ " <td>"+ " <input type=button value=\" ^ \" > </td>"+ " /n <td> <input type = button value = \" & \">"+ " </td>"+ " /n"+ " <td>"+ " <input type=button value=\" * \">"+ " </td> /n"+ " <td>"+ " <input type=button value=\" ( \" > </td>"+ " /n <td> <input type = button value = \" ) \">"+ " </td>"+ " /n"+ " <td>"+ " <input type=button value=\"_ \">"+ " </td>"+ " /n"+ " <td>"+ " <input type=button value=\" + \"> " </td> /n " <td>"+ " <input type=button value=\" | \" > </td>"+ " /n <td colspan = \"1\" rowspan=\"2 \">"+ " <input name=\"button10 \" type=button value=\"退格 \" onclick=\"setpassvalue();\" onDblClick=\"setpassvalue();\"style = \"width:100px;height:42px\">"+ " /n"+ " </td>"+ " /n"+ " </tr>"+ " /n"+ " <tr align=\"left \" valign=\"middle \">"+ " /n"+ " <td>"+ " <input type=button value=\"` \">"+ " </td>"+ " /n"+ " <td>"+ " <input type=button value=\"1 \">"+ " </td>"+ " /n"+ " <td>"+ " <input type=button value=\"2 \">"+ " </td>"+ " /n"+ " <td>"+ " <input type=button value=\"3 \">"+ " </td>"+ " /n"+ " <td>"+ " <input type=button value=\"4 \">"+ " </td>"+ " /n"+ " <td>"+ " <input type=button value=\"5 \">"+ " </td>"+ " /n"+ " <td>"+ " <input type=button value=\"6 \">"+ " </td>"+ " /n"+ " <td>"+ " <input type=button value=\"7 \">"+ " </td>"+ " /n"+ " <td>"+ " <input type=button value=\"8 \">"+ " </td>"+ " /n"+ " <td>"+ " <input type=button value=\"9 \">"+ " </td>"+ " /n"+ " <td>"+ " <input name=\"button6 \" type=button value=\"0 \">"+ " </td>"+ " /n"+ " <td>"+ " <input type=button value=\" - \">"+ " </td> /n"+ " <td>"+ " <input type=button value=\" = \" > </td>"+ " /n <td> <input type = button value = \" / / \">"+ " </td> /n"+ " <td>"+ " </td> /n"+ " </tr> /n"+ " <tr align=\"left\" valign = \"middle\">"+ " /n"+ " <td>"+ " <input type=button value=\"q \">"+ " </td>"+ " /n"+ " <td>"+ " <input type=button value=\"w \">"+ " </td>"+ " /n"+ " <td>"+ " <input type=button value=\"e \">"+ " </td>"+ " /n"+ " <td>"+ " <input type=button value=\"r \">"+ " </td>"+ " /n"+ " <td>"+ " <input type=button value=\"t \">"+ " </td>"+ " /n"+ " <td>"+ " <input type=button value=\"y \">"+ " </td>"+ " /n"+ " <td>"+ " <input type=button value=\"u \">"+ " </td>"+ " /n"+ " <td>"+ " <input type=button value=\"i \">"+ " </td>"+ " /n"+ " <td>"+ " <input type=button value=\"o \">"+ " </td>"+ " /n"+ " <td>"+ " <input name=\"button8 \" type=button value=\"p \">"+ " </td>"+ " /n"+ " <td>"+ " <input name=\"button9 \" type=button value=\" { \">"+ " </td> /n"+ " <td>"+ " <input type=button value=\" } \" > < /td>"+ " /n <td> <input type = button value = \" [ \">"+ " </td>"+ " /n"+ " <td>"+ " <input type=button value=\" ] \">"+ " </td>"+ " /n"+ " <td>"+ " <input name=\"button9 \" type=button onClick=\"capsLockText();setCapsLock();\" onDblClick=\"capsLockText();setCapsLock();\" value = \"切换大/小写 \" style=\" width: 100px; \">"+ " </td> /n"+ " </tr> /n"+ " <tr align=\"left\" valign = \"middle\">"+ " /n"+ " <td>"+ " <input type=button value=\"a \">"+ " </td>"+ " /n"+ " <td>"+ " <input type=button value=\"s \">"+ " </td>"+ " /n"+ " <td>"+ " <input type=button value=\"d \">"+ " </td>"+ " /n"+ " <td>"+ " <input type=button value=\"f \">"+ " </td>"+ " /n"+ " <td>"+ " <input type=button value=\"g \">"+ " </td>"+ " /n"+ " <td>"+ " <input type=button value=\"h \">"+ " </td>"+ " /n"+ " <td>"+ " <input type=button value=\" j \">"+ " </td>"+ " /n"+ " <td>"+ " <input name=\"button3 \" type=button value=\"k \">"+ " </td>"+ " /n"+ " <td>"+ " <input name=\"button4 \" type=button value=\"l \">"+ " </td>"+ " /n"+ " <td>"+ " <input name=\"button5 \" type=button value=\": \">"+ " </td> /n"+ " <td>"+ " <input name=\"button7\" type = button value = \" " \"></td>/n " <td> <input type=button value=\"; \"></td> /n " <td> <input type=button value=\"' \" > </td>/n " <td rowspan = \"2\" colspan=\"2 \"> <input name=\"button12 \" type=button onclick=\"OverInput();\" value=\" 确定 \" style = \"width:130px;height:42\"></td>/n </tr>/n " <tr align=\"left \" valign=\"middle \"> /n " <td> <input name=\"button2 \" type=button value=\"z \"></td>/n " <td> <input type=button value=\"x \"></td>/n " <td> <input type=button value=\"c \"></td>/n " <td> <input type=button value=\"v \"></td>/n " <td> <input type=button value=\"b \"></td>/n " <td> <input type=button value=\"n \"></td>/n " <td> <input type=button value=\"m \"></td>/n " <td> <input type=button value=\" < \"></td > /n " <td> <input type=button value=\" > \" > </td>/n " <td> <input type = button value = \" ? \"></td>/n " <td> <input type=button value=\", \"></td> /n " <td> <input type=button value=\" . \" > </td>/n " <td> <input type = button value = \" / \"></td>/n " </tr>/n " </table></td> " </form> </tr> " </table></div>") |
登录验证码
1 2 3 4 5 6 |
function showLoginImg() { document.write("<img src='http://ptverifypaipai.paipai.com/getimage?" + Math.random() + "' align='absmiddle' id='loginImg'> <a href='#' onclick='refreshLoginImg()'>刷新</a>"); } function refreshLoginImg() { document.getElementById("loginImg").src = "http://ptverifypaipai.paipai.com/getimage?" + Math.random(); } |
登录随机图片
[code] ?function showLoginImg(){ ? document.write(̶ […]
表单中头像处理判断及回显
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 |
<script type="text/javascript"> var staticNum = 0; function previewNewAvatar(uri, from) { staticNum = 0; var span = document.getElementById("CurrentAvatar"); var flag11 = document.getElementById("hiddenflag1"); var flag12 = document.getElementById("hiddenflag2"); if (from == "signature") { span = document.getElementById("signature"); } var form = document.getElementById("editprofile"); if (from == "Album") { span.innerHTML = "<img id='showface' src='http://image.taobao.com/forum/gallery/" + uri + "' alt='' />"; } else { if (uri != null) { var uris = uri.split("."); if (uris[uris.length - 1].toUpperCase() == 'GIF' || uris[uris.length - 1].toUpperCase() == "JPG" || uris[uris.length - 1].toUpperCase() == "JPEG") { uri = "file:///" + uri; //alert(from); if (from == "signature") { span.innerHTML = "<img id='showsign' src='" + uri + "' alt='' onload='return detectSign();'/>"; } else { span.innerHTML = "<img id='showface' src='" + uri + "' alt='' onload='return detectFlower();'/>"; } } else { alert("请上传jpg,jpeg或者gif格式的图片哦!"); span.innerHTML = "<img src='' alt='请选择合适的图片!' heigth='120' width='120' />"; //form.reset(); if (from == "signature") { flag11.value = 1; } else { flag12.value = 1; } return; } } } } function imgExceedSize(w, h, value) { var flag21 = document.getElementById("hiddenflag1"); var flag22 = document.getElementById("hiddenflag2"); var show = document.getElementById("showface"); var span = document.getElementById("CurrentAvatar"); if (value == "signature") { show = document.getElementById("showsign"); span = document.getElementById("signature"); } var form = document.getElementById("editprofile"); //alert("width:"+show.width); //alert("height:"+show.height); if (show.width > w || show.height > h) { alert("图像尺寸:" + show.width + "X" + show.height + "。/n图像尺寸过大!你只能上传尺寸为 " + w + "×" + h + "的图像,请重新浏览图片!"); span.innerHTML = "<img src='' alt='请选择合适的图片!' width='120' width='120'>"; //form.reset(); if (value == "signature") { //alert("signature flag1:" + flag21); flag21.value = 1; } else { //alert("no flag1:" + flag22); flag22.value = 1; } return false; } else { if (value == "signature") { //alert("signature flag1:" + flag21); flag21.value = 0; } else { //alert("no flag1:" + flag22); flag22.value = 0; } return true; } } function detectFlower() { if (0 == staticNum) { staticNum++; var ok = imgExceedSize(120, 120, 'CurrentAvatar'); } } function detectSign() { if (0 == staticNum) { staticNum++; var ok = imgExceedSize(468, 60, 'signature'); } } --> </script> <hr /> <div class="FormElement"> <label> 头像: </label> <div> <input name="_fmf.edi._0.a" id="ep.pic1" type="radio" value="1" tabindex="1" /> <label for="ep.pic1"> 启用 </label> <input name="_fmf.edi._0.a" id="ep.pic2" type="radio" value="0" tabindex="2" checked="checked" /> <label for="ep.pic2"> 关闭 </label> <p> 启用此选项,你发表的每一个帖子左侧将显示您的头像。 </p> </div> </div> <div class="FormElement"> <label> 当前头像: </label> <div id="CurrentAvatar"> 无头像 </div> </div> <input type="hidden" name="_fmf.edi._0.av" value="0" /> <input type="hidden" name="_fmf.edi._0.user" value="" /> <div class="FormElement"> <label> 上传新头像: </label> <div> <input id="headpicture" name="userAvatar" type="file" tabindex="3" onchange="previewNewAvatar(this.value,'currentavatar')" /> <p> 要求:图片尺寸最大120*120像素,文件大小100k以内(支持JPG,GIF)。 </p> </div> </div> <div class="FormElement"> <label> 系统相册: </label> <div> <input name="new_avatar_uri" id="NewAvatarURI" type="hidden" value="" /> <input name="open_avatar_list" type="button" tabindex="4" value="打开系统相册" onclick="javascript:window.open('forumPic.htm');" /> <p> 从系统相册中选择一个头像(如果您的浏览器打开了屏蔽弹出窗口的功能,请关闭)。 </p> </div> </div> <form action="#" id="AvatarSelector"> <table border="0" cellpadding="3" cellspacing="0" width="100%" class="AvatarList"> <tr> <td> <input type="radio" name="avatarselect" value="002/icons-302.gif" /> <img src="http://image.taobao.com/forum/gallery/002/icons-302.gif" alt="Icons-302" title="Icons-302" /> </td> <td> <input type="radio" name="avatarselect" value="002/icons-306.gif" /> <img src="http://image.taobao.com/forum/gallery/002/icons-306.gif" alt="Icons-306" title="Icons-306" /> </td> <td> <input type="radio" name="avatarselect" value="002/icons-307.gif" /> <img src="http://image.taobao.com/forum/gallery/002/icons-307.gif" alt="Icons-307" title="Icons-307" /> </td> <td> <input type="radio" name="avatarselect" value="002/icons-308.gif" /> <img src="http://image.taobao.com/forum/gallery/002/icons-308.gif" alt="Icons-308" title="Icons-308" /> </td> <td> <input type="radio" name="avatarselect" value="002/icons-309.gif" /> <img src="http://image.taobao.com/forum/gallery/002/icons-309.gif" alt="Icons-309" title="Icons-309" /> </td> </tr> <tr> <td> <input type="radio" name="avatarselect" value="002/icons-302.gif" /> <img src="http://image.taobao.com/forum/gallery/002/icons-302.gif" alt="Icons-302" title="Icons-302" /> </td> <td> <input type="radio" name="avatarselect" value="002/icons-306.gif" /> <img src="http://image.taobao.com/forum/gallery/002/icons-306.gif" alt="Icons-306" title="Icons-306" /> </td> <td> <input type="radio" name="avatarselect" value="002/icons-307.gif" /> <img src="http://image.taobao.com/forum/gallery/002/icons-307.gif" alt="Icons-307" title="Icons-307" /> </td> <td> <input type="radio" name="avatarselect" value="002/icons-308.gif" /> <img src="http://image.taobao.com/forum/gallery/002/icons-308.gif" alt="Icons-308" title="Icons-308" /> </td> <td> <input type="radio" name="avatarselect" value="002/icons-309.gif" /> <img src="http://image.taobao.com/forum/gallery/002/icons-309.gif" alt="Icons-309" title="Icons-309" /> </td> </tr> </table> </form> <hr /> <div style="text-align:center;"> <input type="button" name="submitavatar" value="选择头像" class="mainoption" onclick="doSelect();" /> </div> <script type="text/javascript"> function doSelect() { var x = document.getElementById("AvatarSelector").avatarselect; for (var i = 0; i < x.length; i++) { if (x[i].checked) { window.opener.document.getElementById("NewAvatarURI").value = x[i].value; window.opener.previewNewAvatar(x[i].value, "Album"); window.close(); } } } </script> |
客户端表单通用验证
<head> <script> /////////////////////////// […]
填写信息提示
[code] <head> <style type=”text/css̶ […]
注册延时
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
<form name="agree" method="post" action=""> <center> <input type="submit" name="agreeb" value="同 意" style="height: 23px"> <input type="button" name="return" value="不同意" style="height: 23px" onclick="javascript:history.go(-1);"> </center> </form> <script type="text/javascript"> <!-- var secs = 8; document.agree.agreeb.disabled = true; for (i = 1; i <= secs; i++) { window.setTimeout("update(" + i + ")", i * 1000); } function update(num) { if (num == secs) { document.agree.agreeb.value = " 我 同 意 "; document.agree.agreeb.disabled = false; } else { printnr = secs - num; document.agree.agreeb.value = "请认真查看<条款和声明> (" + printnr + " 秒后继续)"; } } //--> </script> |
[crayon-6868c16963a5a3 […]
注册检查
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 |
<script language="JavaScript"> function isNumeric(strNumber) { return (strNumber.search(/^(-|/ + ) ? /d+(/. / d + ) ? $ / ) != -1); } // this function returns TRUE if a email address is right format function isEmail() { var email = (regfrm.email.value); // valid format "a@b.cd" invalidChars = " /;,:{}[]|*%$#!()`<>?"; if (email == "") { alert("请输入Email地址!"); regfrm.email.focus(); return false; } for (var i = 0; i < invalidChars.length; i++) { badChar = invalidChars.charAt(i); if (email.indexOf(badChar, 0) > -1) { alert("Email地址输入不正确!"); regfrm.email.focus(); return false; } } atPos = email.indexOf("@", 1) // there must be one "@" symbol if (atPos == -1) { alert("Email地址输入不正确!"); regfrm.email.focus(); return false; } if (email.indexOf("@", atPos + 1) != -1) { // and only one "@" symbol alert("Email地址输入不正确!"); regfrm.email.focus(); return false; } periodPos = email.indexOf(".", atPos); if (periodPos == -1) { // and at least one "." after the "@" alert("Email地址输入不正确!"); regfrm.email.focus(); return false; } // and at least one character between "@" and "." if (atPos + 2 > periodPos) { alert("Email地址输入不正确!"); regfrm.email.focus(); return false; } if (periodPos + 3 > email.length) { alert("Email地址输入不正确!"); regfrm.email.focus(); return false; } return true; } //function for check tel.no function istel(test) { var tel = test; var validchars = "-()1234567890 "; if (tel.length == 0) { alert("请输入电话号码!"); regfrm.phone.focus(); return false; } for (i = 0; i < tel.length; i++) { telchar = tel.charAt(i); if (validchars.indexOf(telchar, 0) == -1) { alert("电话号码输入不正确!"); regfrm.phone.focus(); return false; } } return true; } function isDate(day, month, year) { // let's first check the user entered numbers if (isNaN(Date.parse(month + "/" + day + "/" + year))) { return false; } var dd = parseInt(day, 10); // beware !! the computer handles monthes from 0 to 11. var mm = parseInt(month, 10) - 1; var yy = parseInt('20' + year, 10); var date = new Date(yy, mm, dd); //let's now compare the user's entry with what the computer understand of it if (dd != date.getDate() || mm != date.getMonth() || yy != date.getFullYear()) { return false; } return true; } function checkinput() { if (regfrm.checkbox.checked == false) { alert("您仔细阅读了《久游用户注册协议书》?"); return false; } if (regfrm.username.value.length == 0) { alert("请输入用户名"); regfrm.username.focus(); return false; } var r, re = new RegExp("[A-Za-z0-9]+", "g"); var s = regfrm.username.value; r = s.match(re); if (r == null || s.length != r[0].length) { alert("用户名只能为英数!"); regfrm.username.focus(); return false; } if (regfrm.username.value.length < 6) { alert("用户名必须大于6位"); regfrm.username.focus(); return false; } if (regfrm.username.value.length > 12) { alert("用户名不能超过12位"); regfrm.username.focus(); return false; } if (regfrm.nickname.value.length == 0) { alert("请输入昵称"); regfrm.nickname.focus(); return false; } if (regfrm.nickname.value.length > 16) { alert("昵称不能超过8个中文字符或者16个英文数字等组合"); regfrm.nickname.focus(); return false; } if (regfrm.password.value.length == 0) { alert("请输入密码"); regfrm.password.focus(); return false; } if (regfrm.password.value.length < 6) { alert("密码必须大于6位"); regfrm.password.focus(); return false; } if (regfrm.password.value.length > 20) { alert("密码不能超过20位"); regfrm.password.focus(); return false; } if (regfrm.password.value != regfrm.psw2.value) { alert("您两次输入的密码不一致"); regfrm.password.focus(); return false; } if (regfrm.secureCode.value.length == 0) { alert("请输入安全码"); regfrm.secureCode.focus(); return false; } if (regfrm.secureCode.value.length < 6) { alert("安全码必须大于6位"); regfrm.secureCode.focus(); return false; } if (regfrm.secureCode.value.length > 12) { alert("安全码不能超过12位"); regfrm.secureCode.focus(); return false; } if (regfrm.secureCode.value != regfrm.SerCode2.value) { alert("您两次输入的安全码不一致"); regfrm.secureCode.focus(); return false; } if (regfrm.idcard.value.length == 0) { alert("请输入身份证号码"); regfrm.idcard.focus(); return false; } var tempidcard = regfrm.idcard.value; if (regfrm.cardtype[1].checked == true) { if (regfrm.idcard.value.length != 18) { alert("身份证号码位数不对!"); regfrm.idcard.focus(); return false; } idcardlast = tempidcard.substring(17, 18); idcardfor = tempidcard.substring(0, 17); if (!isNumeric(idcardfor)) { alert("身份证号前17位必须是数字!"); regfrm.idcard.focus(); return false; } if (!isNumeric(idcardlast) && idcardlast != "x" && idcardlast != "X") { alert("身份证号最后一位必须是数字或者X!"); regfrm.idcard.focus(); return false; } } if (regfrm.cardtype[0].checked == true) { if (regfrm.idcard.value.length != 15) { alert("身份证号码位数不对!"); regfrm.idcard.focus(); return false; } idcardlast = tempidcard.substring(14, 15); idcardfor = tempidcard.substring(0, 14); if (!isNumeric(idcardfor)) { alert("身份证号前14位必须是数字!"); regfrm.idcard.focus(); return false; } if (!isNumeric(idcardlast) && idcardlast != "x" && idcardlast != "X") { alert("身份证号最后一位必须是数字或者X!"); regfrm.idcard.focus(); return false; } } if (isEmail() == false) { return false; } if (regfrm.realname.value.length == 0) { alert("请输入您的真实姓名"); regfrm.realname.focus(); return false; } if (regfrm.year.value.length == 0 || regfrm.year.value.length != 4) { alert("生日的年份必须为4位"); regfrm.year.focus(); return false; } if (isDate(regfrm.day.value, regfrm.month.value, regfrm.year.value) == false) { alert("您的生日输入有误"); regfrm.year.focus(); return false; } return true; } </script> |
Javascript正确检测文章长度
[code] function strLen(str) { var len = 0; for(var i = […]
JS操作cookie
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
<script language = "javascript" > function setCookie(name, value) { /* *--------------- setCookie(name,value) ----------------- * setCookie(name,value) * 功能:设置得变量name的值 * 参数:name,字符串;value,字符串. * 实例:setCookie('username','baobao') *--------------- setCookie(name,value) ----------------- */ var Days = 30; //此 cookie 将被保存 30 天 var exp = new Date(); exp.setTime(exp.getTime() + Days * 24 * 60 * 60 * 1000); document.cookie = name + "=" + escape(value) + ";expires=" + exp.toGMTString(); location.href = "bb.htm"; //接收页面. } function getCookie(name) { /* *--------------- getCookie(name) ----------------- * getCookie(name) * 功能:取得变量name的值 * 参数:name,字符串. * 实例:alert(getCookie("baobao")); *--------------- getCookie(name) ----------------- */ var arr = document.cookie.match(new RegExp("(^| )" + name + "=([^;]*)(;|$)")); if (arr != null) return unescape(arr[2]); return null; } inn = getCookie("baobao"); alert(inn); function getCookie(name) { var search = name + "="; var offset = document.cookie.indexOf(search); if (offset != -1) { offset += search.length; var end = document.cookie.indexOf(";", offset); if (end == -1) end = document.cookie.length; return unescape(document.cookie.substring(offset, end)); } else return ""; } function setCookie(name, value, hours) { var expireDate = new Date(new Date().getTime() + hours * 3600000); document.cookie = name + "=" + escape(value) + "; path=/; domain = xunlei.com;expires = " + expireDate.toGMTString(); } </script> |
双击滚动,单击停止
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
<html> <head></head> <body> <div id="time"></div> <a href="###">测试</a> <div style="height:500px;"></div> <div style="height:500px;"></div> <script type='text/javascript'> var shida_top, timer; function shida_stop() { timer = setInterval("shida_scrollwindow()", 1); } function shida_start() { clearInterval(timer); } function shida_scrollwindow() { shida_top = document.body.scrollTop; window.scroll(0, ++shida_top); if (shida_top != document.body.scrollTop) shida_start(); } document.onmousedown = shida_start; document.ondblclick = shida_stop; </script> </body> </html> |
时间条
[code] function dateinbar() { var d=new Date(); var mon […]
Javascript显示时间条
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
<div id="time"></div> <a href="###">测试</a> <script type='text/javascript'> function dateinbar() { var d = new Date(); var mon = d.getMonth() + 1; var year = d.getFullYear(); var date = d.getDate(); var h = d.getHours(); var m = d.getMinutes(); var s = d.getSeconds(); var AorP = " "; if (h >= 12) AorP = "PM"; else AorP = "AM"; if (h >= 13) h = h - 12; if (s < 10) s = "0" + s; if (m < 10) m = "0" + m; var defaultStatus = "当前日期 " + year + "年" + mon + "月" + date + "日 " + " 当前时间 " + h + ":" + m + ":" + s + " " + AorP; document.getElementById("time").innerHTML = defaultStatus; setTimeout("dateinbar()", 1000); } dateinbar(); </script> |
增加鼠标超链接特效
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 |
<script type='text/javascript'> //<![CDATA[ var rate = 20; if (document.getElementById) window.onerror=new Function("return true") var objActive; // The object which event occured in var act = 0; // Flag during the action var elmH = 0; // Hue var elmS = 128; // Saturation var elmV = 255; // Value var clrOrg; // A color before the change var TimerID; // Timer ID if (document.all) { document.onmouseover = doRainbowAnchor; document.onmouseout = stopRainbowAnchor; } else if (document.getElementById) { document.captureEvents(Event.MOUSEOVER | Event.MOUSEOUT); document.onmouseover = Mozilla_doRainbowAnchor; document.onmouseout = Mozilla_stopRainbowAnchor; } function doRainbow(obj) { if (act == 0) { act = 1; if (obj) objActive = obj; else objActive = event.srcElement; clrOrg = objActive.style.color; TimerID = setInterval("ChangeColor()",100); } } function stopRainbow() { if (act) { objActive.style.color = clrOrg; clearInterval(TimerID); act = 0; } } function doRainbowAnchor() { if (act == 0) { var obj = event.srcElement; while (obj.tagName != 'A' && obj.tagName != 'BODY') { obj = obj.parentElement; if (obj.tagName == 'A' || obj.tagName == 'BODY') break; } if (obj.tagName == 'A' && obj.href != '') { objActive = obj; act = 1; clrOrg = objActive.style.color; TimerID = setInterval("ChangeColor()",100); } } } function stopRainbowAnchor() { if (act) { if (objActive.tagName == 'A') { objActive.style.color = clrOrg; clearInterval(TimerID); act = 0; } } } function Mozilla_doRainbowAnchor(e) { if (act == 0) { obj = e.target; while (obj.nodeName != 'A' && obj.nodeName != 'BODY') { obj = obj.parentNode; if (obj.nodeName == 'A' || obj.nodeName == 'BODY') break; } if (obj.nodeName == 'A' && obj.href != '') { objActive = obj; act = 1; clrOrg = obj.style.color; TimerID = setInterval("ChangeColor()",100); } } } function Mozilla_stopRainbowAnchor(e) { if (act) { if (objActive.nodeName == 'A') { objActive.style.color = clrOrg; clearInterval(TimerID); act = 0; } } } function ChangeColor() { objActive.style.color = makeColor(); } function makeColor() { // Don't you think Color Gamut to look like Rainbow? // HSVtoRGB if (elmS == 0) { elmR = elmV; elmG = elmV; elmB = elmV; } else { t1 = elmV; t2 = (255 - elmS) * elmV / 255; t3 = elmH % 60; t3 = (t1 - t2) * t3 / 60; if (elmH < 60) { elmR = t1; elmB = t2; elmG = t2 + t3; } else if (elmH < 120) { elmG = t1; elmB = t2; elmR = t1 - t3; } else if (elmH < 180) { elmG = t1; elmR = t2; elmB = t2 + t3; } else if (elmH < 240) { elmB = t1; elmR = t2; elmG = t1 - t3; } else if (elmH < 300) { elmB = t1; elmG = t2; elmR = t2 + t3; } else if (elmH < 360) { elmR = t1; elmG = t2; elmB = t1 - t3; } else { elmR = 0; elmG = 0; elmB = 0; } } elmR = Math.floor(elmR).toString(16); elmG = Math.floor(elmG).toString(16); elmB = Math.floor(elmB).toString(16); if (elmR.length == 1) elmR = "0" + elmR; if (elmG.length == 1) elmG = "0" + elmG; if (elmB.length == 1) elmB = "0" + elmB; elmH = elmH + rate; if (elmH >= 360) elmH = 0; return '#' + elmR + elmG + elmB; } //]]> </script> <a href="###">测试</a> |