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 |
<p style="height:500px">a</p> <p style="height:500px">a</p> <p style="height:500px">a</p> <div id="floater" style="position:absolute; left:820px; top:140px; width:167px; height:364px; z-index:0; overflow: hidden;"> <table width="100%" cellspacing="0" cellpadding="0"> <tr> <td> <img src="../images/temp_img.gif" width="167" height="43"> </td> </tr> <tr> <td valign="top" background="images/you2.gif"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td align="center"> <table border="0" cellpadding="2" cellspacing="2"> <tr> <td> <table border='0' cellpadding='0' cellspacing='0'> <tbody> <tr> <td align="center" valign="middle"> <a href="/gb/prodshow.asp?id=783" target="_blank"><img src="/up/prod/783_1.gif" width="100" height="120" border='0'></a> </td> </tr> </tbody> </table> </td> </tr> </table> </td> </tr> <tr> <td align="center"> <b>03</b> </td> </tr> <tr> <td align="center"> <table border="0" cellpadding="2" cellspacing="2"> <tr> <td> <table border='0' cellpadding='0' cellspacing='0'> <tbody> <tr> <td align="center" valign="middle"> <a href="/gb/prodshow.asp?id=766" target="_blank"><img src="/up/prod/766_1.gif" width="100" height="120" border='0'></a> </td> </tr> </tbody> </table> </td> </tr> </table> </td> </tr> <tr> <td align="center"> <b>06</b> </td> </tr> </table> </td> </tr> <tr> <td> <img src="images/you3.gif" width="167" height="12"> </td> </tr> </table> </div> <script language="JavaScript"> 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.floater.style.pixelTop += percent; if (NS) document.floater.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.floater.style.pixelLeft += percent; if (NS) document.floater.left += percent; lastScrollX = lastScrollX + percent; } } function checkFocus(x, y) { stalkerx = document.floater.pageX; stalkery = document.floater.pageY; stalkerwidth = document.floater.clip.width; stalkerheight = document.floater.clip.height; if ((x > stalkerx && x < (stalkerx + stalkerwidth)) && (y > stalkery && y < (stalkery + stalkerheight))) return true; else return false; } function grabIt(e) { if (IE) { whichIt = event.srcElement; while (whichIt.id.indexOf("floater") == -1) { whichIt = whichIt.parentElement; if (whichIt == null) { return true; } } whichIt.style.pixelLeft = whichIt.offsetLeft; whichIt.style.pixelTop = whichIt.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 = document.floater; StalkerTouchedX = e.pageX - document.floater.pageX; StalkerTouchedY = e.pageY - document.floater.pageY; } } return true; } function moveIt(e) { if (whichIt == null) { return false; } if (IE) { newX = (event.clientX + document.body.scrollLeft); newY = (event.clientY + document.body.scrollTop); distanceX = (newX - currentX); distanceY = (newY - currentY); currentX = newX; currentY = newY; whichIt.style.pixelLeft += distanceX; whichIt.style.pixelTop += distanceY; if (whichIt.style.pixelTop < document.body.scrollTop) whichIt.style.pixelTop = document.body.scrollTop; if (whichIt.style.pixelLeft < document.body.scrollLeft) whichIt.style.pixelLeft = document.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); </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 |
<table border='"0"' cellpadding='"0"' cellspacing='"0"' align='"center"'> <tr> <td> <script language='JavaScript'> var bannerAD = new Array(); var bannerADlink = new Array(); var adNum = 0; bannerAD[0] = "http: //img1.qq.com/edu/20050922/2358881.jpg"; bannerADlink[0] = "http: //edu.qq.com/a/20050921/000100.htm"; bannerAD[1] = "http: //img1.qq.com/edu/20050927/2384917.jpg"; bannerADlink[1] = "http: //edu.qq.com/kaoyan/yzzxh.shtml"; bannerAD[2] = "http: //img1.qq.com/edu/20050928/2392784.jpg"; bannerADlink[2] = "http: //edu.qq.com/photo/photo.shtml"; bannerAD[3] = "http: //img1.qq.com/edu/20050922/2358906.gif"; bannerADlink[3] = "http: //edu.qq.com/a/20050920/000114.htm"; var preloadedimages = new Array(); for (i = 0; i < 4; i++) { preloadedimages[i] = new Image(); preloadedimages[i].src = bannerAD[i]; } function setTransition() { if (document.all) { bannerADrotator.filters.revealTrans.Transition = Math.floor(Math.random() * 23); bannerADrotator.filters.revealTrans.apply(); } } function playTransition() { if (document.all) bannerADrotator.filters.revealTrans.play() } function nextAd() { if (adNum < bannerAD.length - 1) adNum++; else adNum = 0; setTransition(); document.images.bannerADrotator.src = bannerAD[adNum]; playTransition(); theTimer = setTimeout("nextAd()", 4000); } function jump2url() { jumpUrl = bannerADlink[adNum]; jumpTarget = '_blank'; if (jumpUrl != "") { if (jumpTarget != "") window.open(jumpUrl, jumpTarget); else location.href = jumpUrl; } } function displayStatusMsg() { status = bannerADlink[adNum]; document.returnValue = true; } </script> <a onmouseover='displayStatusMsg();return document.returnvalue' href='javascript:jump2url();'> <img style="FILTER: revealtrans(duration=2,transition=20)" height='230' src="javascript:nextAd()" width='200' border='0' name='bannerADrotator'></a> </td> </tr> </table> |
图片连接
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 |
<head> <script type="text/javascript"> function toup2(theobject) { logo = 1; gogo(theobject); } function todown2(theobject) { logo = 0; down(theobject); } function gogo(image) { theobject = image; if (logo == 1 && theobject.filters.alpha.opacity < 100) { theobject.filters.alpha.opacity += 20; var upalpha = setTimeout("gogo(theobject)", 300) } } function down(theobject) { if (logo == 0 && theobject.filters.alpha.opacity > 80) { theobject.filters.alpha.opacity -= 20; var downalpha = setTimeout("down(theobject)", 300) } } function MM_openBrWindow(theURL, winName, features) { //v2.0 window.open(theURL, winName, features); } function MM_goToURL() { //v3.0 var i, args = MM_goToURL.arguments; document.MM_returnValue = false; for (i = 0; i < (args.length - 1); i += 2) eval(args[i] + ".location='" + args[i + 1] + "'"); } function MM_findObj(n, d) { //v4.01 var p, i, x; if (!d) d = document; if ((p = n.indexOf("?")) > 0 && parent.frames.length) { d = parent.frames[n.substring(p + 1)].document; n = n.substring(0, p); } if (!(x = d[n]) && d.all) x = d.all[n]; for (i = 0; !x && i < d.forms.length; i++) x = d.forms[i][n]; for (i = 0; !x && d.layers && i < d.layers.length; i++) x = MM_findObj(n, d.layers[i].document); if (!x && d.getElementById) x = d.getElementById(n); return x; } function setAuthor(str) { var obj = document.form2.name; obj.value = str; } function setAuthor1(str) { var obj = document.form1.news_author; obj.value = str; } function YY_checkform() { var args = YY_checkform.arguments; var myDot = true; var myV = ''; var myErr = ''; var addErr = false; var myReq; for (var i = 1; i < args.length; i = i + 4) { if (args[i + 1].charAt(0) == '#') { myReq = true; args[i + 1] = args[i + 1].substring(1); } else { myReq = false } var myObj = MM_findObj(args[i].replace(/[/d+/]/ig, "")); myV = myObj.value; if (myObj.type == 'text' || myObj.type == 'password' || myObj.type == 'hidden') { if (myReq && myObj.value.length == 0) { addErr = true; } if ((myV.length > 0) && (args[i + 2] == 1)) { //fromto var myMa = args[i + 1].split('_'); if (isNaN(myV) || myV < myMa[0] / 1 || myV > myMa[1] / 1) { addErr = true; } } else if ((myV.length > 0) && (args[i + 2] == 2)) { var rx = new RegExp("^[//w/.=-]+@[//w//.-]+//.[a-z]{2,4}$"); if (!rx.test(myV)) addErr = true; } else if ((myV.length > 0) && (args[i + 2] == 3)) { // date var myMa = args[i + 1].split("#"); var myAt = myV.match(myMa[0]); if (myAt) { var myD = (myAt[myMa[1]]) ? myAt[myMa[1]] : 1; var myM = myAt[myMa[2]] - 1; var myY = myAt[myMa[3]]; var myDate = new Date(myY, myM, myD); if (myDate.getFullYear() != myY || myDate.getDate() != myD || myDate.getMonth() != myM) { addErr = true }; } else { addErr = true } } else if ((myV.length > 0) && (args[i + 2] == 4)) { // time var myMa = args[i + 1].split("#"); var myAt = myV.match(myMa[0]); i f(!myAt) { addErr = true } } else if (myV.length > 0 && args[i + 2] == 5) { // check this 2 var myObj1 = MM_findObj(args[i + 1].replace(/[/d+/]/ig, "")); if (myObj1.length) myObj1 = myObj1[args[i + 1].replace(/(.*/[)|(/].*)/ig, "")]; if (!myObj1.checked) { addErr = true } } else if (myV.length > 0 && args[i + 2] == 6) { // the same var myObj1 = MM_findObj(args[i + 1]); if (myV != myObj1.value) { addErr = true } } } else if (!myObj.type && myObj.length > 0 && myObj[0].type == 'radio') { var myTest = args[i].match(/(.*)/ [(/d+)/]. * /i); var myObj1=(myObj.length>1)?myObj[myTest[2]]:myObj; if (args[i+2]==1&&myObj1&&myObj1.checked&&MM_findObj(args[i+1]).value.length/1 == 0) { addErr = true } if (args[i + 2] == 2) { var myDot = false; for (var j = 0; j < myObj.length; j++) { myDot = myDot || myObj[j].checked } if (!myDot) { myErr += '* ' + args[i + 3] + '/n' } } } else if (myObj.type == 'checkbox') { if (args[i + 2] == 1 && myObj.checked == false) { addErr = true } if (args[i + 2] == 2 && myObj.checked && MM_findObj(args[i + 1]).value.length / 1 == 0) { addErr = true } } else if (myObj.type == 'select-one' || myObj.type == 'select-multiple') { if (args[i + 2] == 1 && myObj.selectedIndex / 1 == 0) { addErr = true } } else if (myObj.type == 'textarea') { if (myV.length < args[i + 1]) { addErr = true } } if (addErr) { myErr += '* ' + args[i + 3] + '/n'; addErr = false } } if (myErr != '') { alert('错误:/t/t/t/t/t/n/n' + myErr) } document.MM_returnValue = (myErr == ''); } </script> </head> <body> <table width="525" border="0" cellspacing="0" cellpadding="0"> <tr> <td height="113" align="center"> <!--img src="http://www.lilang.com/pic/cdm06x.jpg" border="1" width="160" height="120" onclick="newimg('picredirectcs.asp?cs_id=48')" style="CURSOR: hand"--> <img src="images/temp_img.gif" border="1" onclick="window.open('picredirectcs.asp?cs_id=48','newwin');return false;" style="CURSOR: hand;filter:alpha(opacity=70)" onmouseover="javascript:toup2(this)" onmouseout="javascript:todown2(this)"> </td> </tr> </table> </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 |
<style type='text/css'> #floater { LEFT: 445px; POSITION: absolute; TOP: 15px; VISIBILITY: visible; WIDTH: 125px; Z-INDEX: 10} </style> <script language='JavaScript'> 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.floater.style.pixelTop += percent; if (NS) document.floater.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.floater.style.pixelLeft += percent; if (NS) document.floater.left += percent; lastScrollX = lastScrollX + percent; } } function checkFocus(x, y) { stalkerx = document.floater.pageX; stalkery = document.floater.pageY; stalkerwidth = document.floater.clip.width; stalkerheight = document.floater.clip.height; if ((x > stalkerx && x < (stalkerx + stalkerwidth)) && (y > stalkery && y < (stalkery + stalkerheight))) return true; else return false; } function grabIt(e) { if (IE) { whichIt = event.srcElement; while (whichIt.id.indexOf("floater") == -1) { whichIt = whichIt.parentElement; if (whichIt == null) { return true; } } whichIt.style.pixelLeft = whichIt.offsetLeft; whichIt.style.pixelTop = whichIt.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 = document.floater; StalkerTouchedX = e.pageX - document.floater.pageX; StalkerTouchedY = e.pageY - document.floater.pageY; } } return true; } function moveIt(e) { if (whichIt == null) { return false; } if (IE) { newX = (event.clientX + document.body.scrollLeft); newY = (event.clientY + document.body.scrollTop); distanceX = (newX - currentX); distanceY = (newY - currentY); currentX = newX; currentY = newY; whichIt.style.pixelLeft += distanceX; whichIt.style.pixelTop += distanceY; if (whichIt.style.pixelTop < document.body.scrollTop) whichIt.style.pixelTop = document.body.scrollTop; if (whichIt.style.pixelLeft < document.body.scrollLeft) whichIt.style.pixelLeft = document.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); </script> <div align='center' id='floater'> <table height='10' width='24'> <tbody> <tr> <td align='middle' height='6' valign='center' width='76'> <!-- 注意更改图片所在路径--> <img border='0' src="C:/My Documents/My Pictures/74.gif"> </td> </tr> </tbody> </table> </div> |
图片精灵
[code] <style type=text/css>#floater { LEFT: 445p […]
图片渐变切换
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 |
<html> <head> <title> 图片特效 </title> </head> <body topmargin="0" leftmargin="0" oncontextmenu="return false"> <noscript> <iframe src="*.html"> </iframe> </noscript> <center> <table style='font-size:9pt' width="100%"> <tr> <td align='center'> <script> var i = 0; var pictures = new Array(); pictures[i++] = "http: //www.lilang.com/pic/hopeshow/hopeshow1.jpg"; pictures[i++] = "http://www.lilang.com/pic/hopeshow/hopeshow2.jpg"; pictures[i++] = "http://www.lilang.com/pic/hopeshow/hopeshow3.jpg"; pictures[i++] = "http://www.lilang.com/pic/hopeshow/hopeshow4.jpg"; pictures[i++] = "http://www.lilang.com/pic/hopeshow/hopeshow5.jpg"; pictures[i++] = "http://www.lilang.com/pic/hopeshow/hopeshow6.jpg"; pictures[i++] = "http://www.lilang.com/pic/hopeshow/hopeshow7.jpg"; var picturewidth = 180; var pictureheight = 144; var delay = 3; if (document.all) { document.write(' <object ID = "DAControl_Wipe"'); document.write('STYLE = "width: ' + picturewidth + ';height: ' + pictureheight + '"'); document.write('CLASSID = "CLSID: B6FFC24C-7E13-11D0-9B47-00C04FC2F51D"> '); document.write(' </object>'); m = DAControl_Wipe.MeterLibrary; whatTransformation = new ActiveXObject("DXImageTransform.Microsoft.Wipe"); whatTransformation.GradientSize = 1.0; whatTransformation.WipeStyle = 0; var myArr = new Array(), myArr2 = new Array(); var len = Math.floor(pictures.length / 2) for (var i = 0; i < len; i++) { myArr[i] = m.ImportImage(pictures[2 * i]); myArr2[i] = m.ImportImage(pictures[2 * i + 1]); } myArr[i] = m.ImportImage(pictures[2 * i]); myArr = m.Array(myArr); myArr2 = m.Array(myArr2); Index = m.Interpolate(0.5, len + 0.5, len * 2 * delay).RepeatForever(); Index2 = m.Interpolate(0, len, len * 2 * delay).RepeatForever(); var whatPictures = new Array(); whatPictures[0] = myArr.NthAnim(Index); whatPictures[1] = myArr2.NthAnim(Index2); forward = m.Interpolate(0, 1, delay); back = m.Interpolate(1, 0, delay); whatMovement = m.Sequence(forward, back).RepeatForever(); theResult = m.ApplyDXTransform(whatTransformation, whatPictures, whatMovement); DAControl_Wipe.Image = theResult.OutputBvr; DAControl_Wipe.Start(); } </script> </td> </tr> </table> </center> </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 |
<script> var img = null; function s() { if (img) { img.removeNode(true); } img = document.createElement("img"); img.style.position = "absolute"; img.style.visibility = "hidden"; img.attachEvent("onreadystatechange", orsc); img.attachEvent("onerror", oe); document.body.insertAdjacentElement("beforeend", img); img.src = inp.value; } function oe() { alert("cant load img"); } function orsc() { if (img.readyState != "complete") return false; alert("图片大小:" + img.offsetWidth + "X" + img.offsetHeight); alert("图片尺寸:" + img.fileSize); } </script> <input id=inp type="file"> <button onclick="s()"> Test </button> |
&nbs […]
横向不间断连续滚动图片效果
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 |
<head> <script type="text/javascript"> imgArr = new Array(); imgArr[0] = "<a href=Javascript:; onmouseMove='javascript:outHover=true'; onMouseover = 'javascript:outHover = true'; onMouseout = 'javascript: outHover = false;mvStart()'><img src = /eWebEditor/UploadFile / 2005327204719938.gif border = 0> </a>"; imgArr[1] = "<a href=Javascript:; onmouseMove='javascript:outHover=true'; onMouseover='javascript:outHover=true'; onMouseout='javascript:outHover=false;mvStart()'><img src=/eWebEditor / UploadFile / 2005327204725420.gif border = 0> </a>"; imgArr[2] = "<a href=Javascript:; onmouseMove='javascript:outHover=true'; onMouseover='javascript:outHover=true'; onMouseout='javascript:outHover=false;mvStart()'><img src=/eWebEditor / UploadFile / 2005327204725360.gif border = 0> </a>"; imgArr[3] = "<a href=Javascript:; onmouseMove='javascript:outHover=true'; onMouseover='javascript:outHover=true'; onMouseout='javascript:outHover=false;mvStart()'><img src=/eWebEditor / UploadFile / 2005327204725406.gif border = 0> </a>"; imgArr[4] = "<a href=Javascript:; onmouseMove='javascript:outHover=true'; onMouseover='javascript:outHover=true'; onMouseout='javascript:outHover=false;mvStart()'><img src=/eWebEditor / UploadFile / 2005327204725266.gif border = 0> </a>"; imgArr[5] = "<a href=Javascript:; onmouseMove='javascript:outHover=true'; onMouseover='javascript:outHover=true'; onMouseout='javascript:outHover=false;mvStart()'><img src=/eWebEditor / UploadFile / 2005327204725696.gif border = 0> </a>"; imgArr[6] = "<a href=Javascript:; onmouseMove='javascript:outHover=true'; onMouseover='javascript:outHover=true'; onMouseout='javascript:outHover=false;mvStart()'><img src=/eWebEditor / UploadFile / 2005327204725993.gif border = 0> </a>"; imgArr[7] = "<a href=Javascript:; onmouseMove='javascript:outHover=true'; onMouseover='javascript:outHover=true'; onMouseout='javascript:outHover=false;mvStart()'><img src=/eWebEditor / UploadFile / 2005327204726451.gif border = 0> </a>"; imgArr[8] = "<a href=Javascript:; onmouseMove='javascript:outHover=true'; onMouseover='javascript:outHover=true'; onMouseout='javascript:outHover=false;mvStart()'><img src=/eWebEditor / UploadFile / 2005327204726631.gif border = 0> </a>"; imgArr[9] = "<a href=Javascript:; onmouseMove='javascript:outHover=true'; onMouseover='javascript:outHover=true'; onMouseout='javascript:outHover=false;mvStart()'><img src=/eWebEditor / UploadFile / 2005327204726764.gif border = 0> </a>"; imgArr[10] = "<a href=Javascript:; onmouseMove='javascript:outHover=true'; onMouseover='javascript:outHover=true'; onMouseout='javascript:outHover=false;mvStart()'><img src=/eWebEditor / UploadFile / 2005327204726655.gif border = 0> </a>"; var moveStep = 4; //步长,单位:pixel var moveRelax = 100; //移动时间间隔,单位:ms ns4 = (document.layers) ? true : false; var displayImgAmount = 5; //视区窗口可显示个数 var divWidth = 88; //每块图片占位宽 var divHeight = 31; //每块图片占位高 var startDnum = 0; var nextDnum = startDnum + displayImgAmount; var timeID; var outHover = false; var startDivClipLeft; var nextDivClipRight; function initDivPlace() { if (ns4) { for (i = 0; i < displayImgAmount; i++) { eval("document.divOuter.document.divAds" + i + ".left = " + divWidth * i); } for (i = displayImgAmount; i < imgArr.length; i++) { eval("document.divOuter.document.divAds" + i + ".left = " + divWidth * displayImgAmount); } } else { for (i = 0; i < displayImgAmount; i++) { eval("document.all.divAds" + i + ".style.left = " + divWidth * i); } for (i = displayImgAmount; i < imgArr.length; i++) { eval("document.all.divAds" + i + ".style.left = " + divWidth * displayImgAmount); } } } function mvStart() { timeID = setTimeout(moveLeftDiv, moveRelax); } function mvStop() { clearTimeout(timeID); } function moveLeftDiv() { if (ns4) { for (i = 0; i <= displayImgAmount; i++) { eval("document.divOuter.document.divAds" + parseInt((startDnum + i) % imgArr.length) + ".left = document.divOuter.document.divAds" + parseInt((startDnum + i) % imgArr.length) + ".left - moveStep"); } startDivClipLeft = parseInt(eval("document.divOuter.document.divAds" + startDnum + ".clip.left")); nextDivClipRight = parseInt(eval("document.divOuter.document.divAds" + nextDnum + ".clip.right")); if (startDivClipLeft + moveStep > divWidth) { eval("document.divOuter.document.divAds" + nextDnum + ".clip.right = " + divWidth); eval("document.divOuter.document.divAds" + startDnum + ".left = " + divWidth * displayImgAmount); eval("document.divOuter.document.divAds" + parseInt((nextDnum + 1) % imgArr.length) + ".left = document.divOuter.document.divAds" + nextDnum + ".left + " + divWidth); eval("document.divOuter.document.divAds" + parseInt((nextDnum + 1) % imgArr.length) + ".clip.left = 0"); startDnum = (++startDnum) % imgArr.length; nextDnum = (startDnum + displayImgAmount) % imgArr.length; startDivClipLeft = moveStep - (divWidth - startDivClipLeft); nextDivClipRight = moveStep - (divWidth - nextDivClipRight); } else { eval("document.divOuter.document.divAds" + nextDnum + ".clip.left = 0"); startDivClipLeft += moveStep; nextDivClipRight += moveStep; } eval("document.divOuter.document.divAds" + startDnum + ".clip.left = " + startDivClipLeft); eval("document.divOuter.document.divAds" + nextDnum + ".clip.right = " + nextDivClipRight); } else { for (i = 0; i <= displayImgAmount; i++) { eval("document.all.divAds" + parseInt((startDnum + i) % imgArr.length) + ".style.left = document.all.divAds" + parseInt((startDnum + i) % imgArr.length) + ".style.pixelLeft - moveStep"); } startDivClipLeft = parseInt(eval("document.all.divAds" + startDnum + ".currentStyle.clipLeft")); nextDivClipRight = parseInt(eval("document.all.divAds" + nextDnum + ".currentStyle.clipRight")); if (startDivClipLeft + moveStep > divWidth) { eval("document.all.divAds" + nextDnum + ".style.clip = 'rect(0, " + divWidth + ", " + divHeight + ", 0" + ")'"); eval("document.all.divAds" + startDnum + ".style.left = " + divWidth * displayImgAmount); eval("document.all.divAds" + parseInt((nextDnum + 1) % imgArr.length) + ".style.left = document.all.divAds" + nextDnum + ".style.pixelLeft + " + divWidth); startDnum = (++startDnum) % imgArr.length; nextDnum = (startDnum + displayImgAmount) % imgArr.length; startDivClipLeft = moveStep - (divWidth - startDivClipLeft); nextDivClipRight = moveStep - (divWidth - nextDivClipRight); } else { startDivClipLeft += moveStep; nextDivClipRight += moveStep; } eval("document.all.divAds" + startDnum + ".style.clip = 'rect(0, " + divWidth + ", " + divHeight + ", " + startDivClipLeft + ")'"); eval("document.all.divAds" + nextDnum + ".style.clip = 'rect(0, " + nextDivClipRight + ", " + divHeight + ", 0)'"); } if (outHover) { mvStop(); } else { mvStart(); } } function writeDivs() { if (ns4) { document.write(" <ilayer name = divOuter width = 750 height = " + divHeight + "> "); for (i = 0; i < imgArr.length; i++) { document.write(" <layer name = divAds" + i + "> "); document.write(imgArr[i] + ""); document.write(" </layer>"); } document.write("</ilayer> "); document.close(); for (i = displayImgAmount; i < imgArr.length; i++) { eval("document.divOuter.document.divAds" + i + ".clip.right = 0"); } } else { document.write(" <div id = divOuter style = 'position: relative'width = 750 height = " + divHeight + "> "); for (i = 0; i < imgArr.length; i++) { document.write(" <div id = divAds" + i + " style = 'position: absolute;clip: rect(0, " + divWidth + ", " + divHeight + ", 0)'> "); document.write(imgArr[i] + ""); document.write(" </div>") } document.write("</div> "); for (i = displayImgAmount; i < imgArr.length; i++) { eval("document.all.divAds" + i + ".style.clip = 'rect(0, 0, " + divHeight + ", 0)'"); } } } </script> </head> <body onload=javascript:mvStart()> <script type="text/javascript"> writeDivs(); initDivPlace(); </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 |
<html> <head> <title> Background Clock </title> <script language=javaScript> function clockon() { thistime = new Date(); var hours = thistime.getHours(); var minutes = thistime.getMinutes(); var seconds = thistime.getSeconds(); if (eval(hours) < 10) { hours = "0" + hours; } if (eval(minutes) < 10) { minutes = "0" + minutes; } if (seconds < 10) { seconds = "0" + seconds; } thistime = hours + ": " + minutes + ": " + seconds; if (document.all) { bgclocknoshade.innerHTML = thistime; bgclockshade.innerHTML = thistime; } if (document.layers) { document.bgclockshade.document.write(' <div id = "bgclockshade" style = "position: absolute;visibility: visible;font-family: Verdana;color: FFAAAAA;font - size: 120px;top: 10px;left: 152px"> ' + thistime + ' </div>'); document.bgclocknoshade.document.write('<div id="bgclocknoshade" style="position:absolute;visibility:visible;font-family:Verdana;color:DDDDDD;font-size:120px;top:10px;left:150px">' + thistime + '</div > '); document.close(); } var timer = setTimeout("clockon()", 200); } </script> <link rel="stylesheet" href="../style.css"> </head> <body onLoad="clockon()"> 说明:时钟显示的位置需要你修正TOP,LEFT参数来确定。TOP表示层距离显示器顶部的象素值,LEFT表示距离左侧的象素值。 <div id="bgclockshade" style="position:absolute;visibility:visible;font-family:Arial;color:FF8888;font-size:120px;top:102px;left:152px;"> </div> <div id="bgclocknoshade" style="position:absolute;visibility:visible;font-family:Arial;color:DDDDDD;font-size:120px;top:100px;left:150px;"> </div> <div id="mainbody" style="position:absolute; visibility:visible;"> </div> </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 |
<body onLoad="startit()"> <script LANGUAGE="JavaScript"> var isn1=null; var isn2=false; today=new Date(); function stopit() { if(isn2) { clearTimeout(isn1); } isn2=false; } function startit() { stopit(); isnclock(); } function isnclock() { var now=new Date(); var hrs=now.getHours(); var min=now.getMinutes(); var sec=now.getSeconds(); document.clckh.disp1.value=""+((hrs>12)?hrs-12:hrs); document.clckh.disp2.value=((min<10)?"0":"")+min; document.clckh.disp3.value=((sec<10)?"0":"")+sec; document.clckh.disp4.value=(hrs>=12)?"下午":"上午"; isn1=setTimeout("isnclock()",1000); isn2=true; } function isnArray() { argnr=isnArray.arguments.length for(var i=0; i<argnr; i++) { this[i+1]=isnArray.arguments[i]; } } var isnMonths=new isnArray("1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"); var isnDays=new isnArray("星期一","星期二","星期三","星期四","星期五","星期六","星期日");isnDays[0]="星期日"; </script> <form NAME="clckh" onSubmit="0"> <table BORDER="2"> <tr> <td>时间</td> <td><div align="center"><center><p>点</td> <td align="center"><div align="center"><center><p>分</td> <td align="center"><div align="center"><center><p>秒</td> <td align="center"> </td> </tr> <tr align="center"> <td> </td> <td VALIGN="TOP"><input TYPE="text" NAME="disp1" SIZE="2"></td> <td VALIGN="TOP"><input TYPE="text" NAME="disp2" SIZE="2"></td> <td VALIGN="TOP"><input TYPE="text" NAME="disp3" SIZE="2"></td> <td VALIGN="TOP"><input TYPE="text" NAME="disp4" SIZE="3"></td> </tr> <script LANGUAGE="JavaScript"> var thisyear=today.getYear(); if (thisyear< 2000) thisyear=1900+thisyear; document.write("<tr><td>日期</td><td COLSPAN=4>" +isnDays[today.getDay()]+","+isnMonths[today.getMonth()+1] +","+today.getDate()+"月," +thisyear+"年"); </script> </table> </form> |
方形日历
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 |
<script> function Year_Month() { var now = new Date(); var yy = now.getYear(); var mm = now.getMonth() + 1; var cl = ' <font color = "#006699">'; if (now.getDay() == 0) cl = ' <font color = "#c00000"> '; if (now.getDay() == 6) cl = ' <font color = "#00c000">'; return (cl + yy + '年' + mm + '月</font>'); } function Date_of_Today() { var now = new Date(); var cl = ' <font color = "#ff9900"> '; if (now.getDay() == 0) cl = ' <font color = "#c00000"> '; if (now.getDay() == 6) cl = ' <font color = "#00c000">'; return (cl + now.getDate() + '</font>'); } function Day_of_Today() { var day = new Array(); day[0] = " <font color = #FF0000> 星期日 </font>"; day[1] = "星期一"; day[2] = "星期二"; day[3] = "星期三"; day[4] = "星期四"; day[5] = "星期五"; day[6] = "<font color=#FF0000>星期六</font> "; var now = new Date(); var cl = ' <font color = "#006699">'; if (now.getDay() == 0) cl = ' <font color = "#c00000"> '; if (now.getDay() == 6) cl = ' <font color = "#00c000">'; return (cl + day[now.getDay()] + '</font>'); } function CurentTime() { var now = new Date(); var hh = now.getHours(); var mm = now.getMinutes(); var ss = now.getTime() % 60000; ss = (ss-(ss % 1000)) / 1000; var clock = hh + ': '; if (mm < 10) clock += '0'; clock += mm + ':'; if (ss < 10) clock += '0'; clock += ss; return (clock); } function refreshCalendarClock() { document.getElementById("calendarClock1").innerHTML = Year_Month(); document.getElementById("calendarClock2").innerHTML = Date_of_Today(); document.getElementById("calendarClock3").innerHTML = Day_of_Today(); document.getElementById("calendarClock4").innerHTML = CurentTime(); } function getCalendarClockFreeCodeMsg(nn) { if (nn == 'off') { document.getElementById("CalendarClockFreeCode").style.visibility = 'hidden'; } else { document.getElementById("CalendarClockFreeCode").style.visibility = 'visible'; setTimeout("getCalendarClockFreeCodeMsg('off')", 10000); } } var webUrl = webUrl; document.write(' <table border = "0" cellpadding = "0" cellspacing = "0"> <tr> <td> '); document.write(' <table id ="CalendarClockFreeCode" border = "0" cellpadding = "0" cellspacing = "0" width = "60" height = "60"'); document.write(' style = "position: absolute; visibility: hidden" bgcolor = "#eeeeee"> '); document.write(' <tr><td align = "center"> <font '); document.write(' style="cursor:hand; color:#ff0000; font-family: 宋体; font-size: 9pt; line-height: 110% "'); document.write('onclick = getCalendarClockFreeCodeMsg("off"); calendarClockFreeCode();>获取免费代码</font>'); if (webUrl != 'netflower') { document.write('</td> </tr><tr><td align="center"><font '); document.write('style="cursor:hand;color:#2000ff;font-family:宋体;font-size:9pt;line-height:110%" '); document.write('onclick=getCalendarClockFreeCodeMsg("off");window.open("http:/ / www.add114.com", "_blank", "top = 0, left = 0, width = 800, height = 500, toolbar = yes, resizable = yes, scrollbars = yes")> 欢迎访问站长网 </font>'); } document.write('</td> </tr></table> '); document.write(' <table border = "0" cellpadding = "0" cellspacing = "0" width = "75" bgcolor = "#F0E2E5" height = "72"> '); document.write(' <tr> <td valign = "top" width = "100%" height = "100%"> '); document.write(' <table border = "1" cellpadding = "0" cellspacing = "0" width = "72" bgcolor = "#f4f4f4" height = "70"> '); document.write(' <tr> <td align = "center" width = "100 % " height = "100%" onmouseover=getCalendarClockFreeCodeMsg("off")> '); document.write(' <font id = "calendarClock1" style = "font-family: 宋体; font-size: 7pt; line-height: 120% "></font>'); document.write(' <font id = "calendarClock2" style = "font-family:Arial; font-size:14pt; color:red; line-height:120%"> </font> '); document.write(' <font id = "calendarClock3" style = "font-family: 宋体; font - size: 9pt; line-height: 120% "></font>'); document.write(' <font id = "calendarClock4" style = "color:#100080; font-family:宋体; font-size:8pt; line-height:120%"><b> </b> </font>'); document.write('</td> </tr></table> '); document.write(' </td></tr> </table>'); document.write('</td> </tr></table> '); setInterval('refreshCalendarClock()', 1000); </script> |
计算器及日历
<script language=”JavaScript” > //dro […]
开关时间
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
<script language="JavaScript"> var enabled = 0; function TOfunc() { TO = window.setTimeout("TOfunc()", 1000); var today = new Date(); document.clock.disp.value = today.toLocaleString(); } </script> <form name='clock'> <input type='text' name='disp' value='' size='30' onfocus='this.blur()'> <input type='radio' name='rad' value='OFF' checked onclick="if(enabled==1) {document.clock.disp.value='';clearTimeout('TOfunc()' );enabled=0;}"> 关 <input type='radio' name='rad' value='on' onClick="if(enabled == 0) {var to =''; setTimeout( 'TOfunc()', 1000 ); enabled =1;}"> 开 </form> |
日历
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 |
<script> function getTime() { // initialize time-related variables with current time settings var now = new Date(); var hour = now.getHours(); var minute = now.getMinutes(); now = null; var ampm = ""; // validate hour values and set value of ampm if (hour>= 12) { hour -= 12; ampm = "PM"; } else { ampm = "AM"; } hour = (hour == 0) ? 12 : hour; // add zero digit to a one digit minute if (minute <10) minute = "0" + minute; // do not parse this number! // return time string return hour + ": " + minute + "" + ampm; } function leapYear(year) { if (year % 4 == 0) // basic rule return true; // is leap year return false; // is not leap year } function getDays(month, year) { // create array to hold number of days in each month var ar = new Array(12); ar[0] = 31; // January ar[1] = (leapYear(year)) ? 29 : 28; // February ar[2] = 31; // March ar[3] = 30; // April ar[4] = 31; // May ar[5] = 30; // June ar[6] = 31; // July ar[7] = 31; // August ar[8] = 30; // September ar[9] = 31; // October ar[10] = 30; // November ar[11] = 31; // December // return number of days in the specified month (parameter) return ar[month]; } function getMonthName(month) { // create array to hold name of each month var ar = new Array(12); ar[0] = "01"; ar[1] = "02"; ar[2] = "03"; ar[3] = "04"; ar[4] = "05"; ar[5] = "06"; ar[6] = "07"; ar[7] = "08"; ar[8] = "09"; ar[9] = "10"; ar[10] = "11"; ar[11] = "12"; // return name of specified month (parameter) return ar[month]; } function setCal() { // standard time attributes var now = new Date(); var year = now.getYear(); var month = now.getMonth(); var monthName = getMonthName(month); var date = now.getDate(); now = null; // create instance of first day of month, and extract the day on which it occurs var firstDayInstance = new Date(year, month, 1); var firstDay = firstDayInstance.getDay(); firstDayInstance = null; // number of days in current month var days = getDays(month, year); // call function to draw calendar drawCal(firstDay + 1, days, date, monthName, year); } function drawCal(firstDay, lastDate, date, monthName, year) { var tableScript = ""; tableScript += "<table border='0' cellpadding='2' cellspacing='0' width=100% bordercolordark='#ffffff'>" tableScript += " <tr>" tableScript += " <td align='center'></td>" tableScript += " </tr>" tableScript += " <tr>" tableScript += " <td>" tableScript += " <table width='100%' align=center border='0' cellspacing='2' cellpadding='0'>" tableScript += " <tr>" tableScript += " <td>日</td>" tableScript += " <td>一</td>" tableScript += " <td>二</td>" tableScript += " <td>三</td>" tableScript += " <td>四</td>" tableScript += " <td>五</td>" tableScript += " <td>六</td>" tableScript += " </tr>" var digit = 1; var curCell = 1; var day = ""; for (var row = 1; row <= Math.ceil((lastDate + firstDay-1) / 7); ++row) { tableScript += "<tr align = 'right'valign = 'top'> " for (var col = 1; col <= 7; ++col) { if (digit> lastDate) break; if (curCell <firstDay) { tableScript += " <td> </td>"; curCell++; } else { if (digit <10) day = year + '-' + monthName + '-0' + digit; else day = year + '-' + monthName + '-' + digit; if (digit == date) { // current cell represent today's date tableScript += " <td align = center> "; tableScript += " <a HREF = 'showproduct.asp ? day = " + day + "'> " + " <font color = 'red'> <b> " + digit + " </b></font> </a>"; tableScript += "</td> "; } else tableScript += " <td align = center> <a HREF = 'showproduct.asp ? day = " + day + "'> " + digit + " </a></td>"; digit++; } } tableScript += " </tr>" }; tableScript += " "; tableScript += " </table> "; tableScript += " </td>"; tableScript += " </tr> "; tableScript += " </table>"; document.write(tableScript); } setCal(); </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 |
<script type="text/javascript"> window.setTimeout('show_secs()'); var ap_name = navigator.appName; var ap_vinfo = navigator.appVersion; var ap_ver = parseFloat(ap_vinfo.substring(0, ap_vinfo.indexOf('('))); var time_start = new Date(); var clock_start = time_start.getTime(); var dl_ok = false; function init() { if (ap_name == "Netscape" && ap_ver >= 3.0) dl_ok = true; return true; } function get_time_spent() { var time_now = new Date(); return ((time_now.getTime()-clock_start) / 1000); } function show_secs() { var i_total_secs = Math.round(get_time_spent()); var i_secs_spent = i_total_secs % 60; var i_mins_spent = Math.round((i_total_secs - 30) / 60); var s_secs_spent = "" + ((i_secs_spent > 9) ? i_secs_spent : "0" + i_secs_spent); var s_mins_spent = "" + ((i_mins_spent > 9) ? i_mins_spent : "0" + i_mins_spent); document.fm0.time_spent.value = s_mins_spent + ": " + s_secs_spent; window.setTimeout('show_secs()', 1000); } // –> </script> <form name="fm0" onsubmit="0"> <p> <font size="3" color="#000000"> 停留时间 </font> <input name="time_spent" onfocus="this.blur()" size="5"> </p> </form> |
显示农历星期
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 |
<script type="text/javascript"> var bsYear; var bsDate; var bsWeek; var arrLen = 8; var sValue = 0; var dayiy = 0; var miy = 0; var iyear = 0; var dayim = 0; var spd = 86400; var year1999 = "30;29; 29; 30; 29; 29; 30; 29; 30; 30; 30; 29"; var year2000 = "30; 30; 29; 29; 30; 29; 29; 30; 29; 30; 30; 29"; var year2001 = "30;30; 29; 30; 29; 30; 29; 29; 30; 29; 30; 29; 30"; var year2002 = "30; 30; 29; 30; 29; 30; 29; 29; 30; 29; 30; 29"; var year2003 = "30;30; 29; 30; 30; 29; 30; 29; 29; 30; 29; 30"; var year2004 = "29; 30; 29; 30; 30; 29; 30; 29; 30; 29; 30; 29; 30"; var year2005 = "29; 30; 29; 30; 29; 30; 30; 29; 30; 29; 30; 29"; var year2006 = "30; 29; 30; 29; 30; 30; 29; 29; 30; 30; 29; 29; 30"; var month1999 = "正月;二月;三月;四月;五月;六月;七月;八月;九月;十月;十一月;十二月"; var month2001 = "正月;二月;三月;四月;闰四月;五月;六月;七月;八月;九月;十月;十一月;十二月"; var month2004 = "正月;二月;闰二月;三月;四月;五月;六月;七月;八月;九月;十月;十一月;十二月"; var month2006 = "正月;二月;三月;四月;五月;六月;七月;闰七月;八月;九月;十月;十一月;十二月"; var Dn = "初一;初二;初三;初四;初五;初六;初七;初八;初九;初十;十一;十二;十三;十四;十五;十六;十七;十八;十九;二十;廿一;廿二;廿三;廿四;廿五;廿六;廿七;廿八;廿九;三十"; var Ys = new Array(arrLen); Ys[0] = 919094400; Ys[1] = 949680000; Ys[2] = 980265600; Ys[3] = 1013443200; Ys[4] = 1044028800; Ys[5] = 1074700800; Ys[6] = 1107878400; Ys[7] = 1138464000; var Yn = new Array(arrLen); Yn[0] = "己卯年"; Yn[1] = "庚辰年"; Yn[2] = "辛巳年"; Yn[3] = "壬午年"; Yn[4] = "癸未年"; Yn[5] = "甲申年"; Yn[6] = "乙酉年"; Yn[7] = "丙戌年"; var D = new Date(); var yy = D.getYear(); var mm = D.getMonth() + 1; var dd = D.getDate(); var ww = D.getDay(); if (ww == 0) ww = "星期日"; if (ww == 1) ww = "星期一"; if (ww == 2) ww = "星期二"; if (ww == 3) ww = "星期三"; if (ww == 4) ww = "星期四"; if (ww == 5) ww = "星期五"; if (ww == 6) ww = "星期六"; ww = ww; var ss = parseInt(D.getTime() / 1000); if (yy < 100) yy = "19" + yy; for (i = 0; i < arrLen; i++) if (ss >= Ys[i]) { iyear = i; sValue = ss - Ys[i]; } dayiy = parseInt(sValue / spd) + 1; var dpm = year1999; if (iyear == 1) dpm = year2000; if (iyear == 2) dpm = year2001; if (iyear == 3) dpm = year2002; if (iyear == 4) dpm = year2003; if (iyear == 5) dpm = year2004; if (iyear == 6) dpm = year2005; if (iyear == 7) dpm = year2006; dpm = dpm.split(";"); var Mn = month1999; if (iyear == 2) Mn = month2001; if (iyear == 5) Mn = month2004; if (iyear == 7) Mn = month2006; Mn = Mn.split(";"); var Dn = "初一;初二;初三;初四;初五;初六;初七;初八;初九;初十;十一;十二;十三;十四;十五;十六;十七;十八;十九;二十;廿一;廿二;廿三;廿四;廿五;廿六;廿七;廿八;廿九;三十"; Dn = Dn.split(";"); dayim = dayiy; var total = new Array(13); total[0] = parseInt(dpm[0]); for (i = 1; i < dpm.length - 1; i++) total[i] = parseInt(dpm[i]) + total[i - 1]; for (i = dpm.length - 1; i > 0; i--) { if (dayim > total[i - 1]) { dayim = dayim - total[i - 1]; miy = i; } } bsWeek = ww; bsDate = ""+"<b><span class='v8'>"+yy+"</span></b>"+"年"+"<b><span class='v8'>"+mm+"</span></b>"+"月"; bsDate2="<b><span class='v8'>"+dd+"</span></b>"+"日"; bsYear="农历 "+Yn[iyear]; bsYear2=Mn[miy]+Dn[dayim-1]; if (ss>=Ys[7]||ss<ys[0]) bsYear=Yn[7]; function CAL(){ document.write(bsDate+bsDate2+" "+bsWeek+" "+bsYear+" "+bsYear2); } </script> <body onload="CAL();"> |
显示月份天数
<script> function DaysInMonth(year, month) { retu […]
现在日期
<script language=JavaScript> today=new Date(); fu […]
雪花飘落
function rnd(){return Math.random();} function xRnd(){r […]
窗口定时打开定时关闭,表单自动提交
<script language=”javascript”> functi […]
JS窗口操作经典
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 |
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <meta name="GENERATOR" content="Microsoft FrontPage 4.0"> <meta name="ProgId" content="FrontPage.Editor.Document"> <title> 子父窗口的操作 </title> </head> <body> <script> var win = null; function op() { win = window.open("about:blank", "win", "width=200,height=200"); win.document.write("<scri"); win.document.write("PT>window.open('','a','');</scr"); win.document.write("IPT>"); win.document.write("<input type='button' value='关闭父窗口' onclick='window.opener.opener=null;window.opener.close()'>"); win.document.write("<input type='button' value='刷新你窗口' onclick='window.opener.location.reload()'>"); } </script> <input onclick="op()" value="打开窗口" type="button"> <input type="button" value="最小化" onclick="if(win&&win.open&&!win.closed){win.resizeTo(0,0);win.moveTo(0,window.screen.width);}else alert('还没有打开窗口或已经关闭')"> <input type="button" value="最大化" onclick="if(win&&win.open&&!win.closed){win.moveTo(-4,-4);win.resizeTo(screen.availWidth+8,screen.availHeight+8);}else alert('还没有打开窗口或已经关闭');"> <input type=button value="关闭子窗口" onclick="if(win&&win.open&&!win.closed){win.opener=null;win.close()}else alert('还没有打开窗口或已关闭')"> <input type=button value="刷新子窗口" onclick="if(win&&win.open&&!win.closed){win.location.reload();win.focus()}else alert('窗口还没有打开或已关闭')"> <input type="button" value="看子窗口的大小" onclick="if(win&&win.open&&!win.closed){alert(win.document.body.clientWidth+'*'+win.document.body.clientHeight);win.focus();}else{alert('还没有打开窗口或者已关闭')};"> </body> </html> |
js完美关窗
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 |
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <meta name="GENERATOR" content="Microsoft FrontPage 4.0"> <meta name="ProgId" content="FrontPage.Editor.Document"> <title> New Page 1 </title> <!-- by fason(2003-5-20) --> </head> <body> <script type="text/javascript"> function CloseWin() { var ua = navigator.userAgent var ie = navigator.appName == "Microsoft Internet Explorer" ? true : false if (ie) { var IEversion = parseFloat(ua.substring(ua.indexOf("MSIE ") + 5, ua.indexOf(";", ua.indexOf("MSIE ")))) if (IEversion < 5.5) { var str = '<object id=noTipClose classid="clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11">' str += '<param name="Command" value="Close"></object>'; document.body.insertAdjacentHTML("beforeEnd", str); document.all.noTipClose.Click(); } else { window.opener = null; window.close(); } } else { window.close() } } </script> <input type=button value=关闭 onclick="CloseWin()"> </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 |
<script> <!-- function makearray(n) { this.length = n; for (var i = 1; i <= n; i++) this[i] = 0; return this; } hexa = new makearray(16); for (var i = 0; i < 10; i++) hexa[i] = i; hexa[10] = "a"; hexa[11] = "b"; hexa[12] = "c"; hexa[13] = "d"; hexa[14] = "e"; hexa[15] = "f"; function hex(i) { if (i < 0) return "00"; else if (i > 255) return "ff"; else return "" + hexa[Math.floor(i / 16)] + hexa[i % 16]; } function setbgColor(r, g, b) { var hr = hex(r); var hg = hex(g); var hb = hex(b); document.bgColor = "#" + hr + hg + hb; } function fade(sr, sg, sb, er, eg, eb, step) { for (var i = 0; i <= step; i++) { setbgColor(Math.floor(sr * ((step - i) / step) + er * (i / step)), Math.floor(sg * ((step - i) / step) + eg * (i / step)), Math.floor(sb * ((step - i) / step) + eb * (i / step))); } } function fadein() { fade(255, 0, 0, 0, 0, 255, 100); fade(0, 0, 255, 0, 255, 0, 100); fade(0, 255, 0, 0, 0, 0, 100); } fadein(); // --> </script> |
从天而降窗口
从天而降的浏览器(效果是不是很惊人无需修改复制到html的<body> </body> […]