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> […]
滚动背景
滚动的背景(见过吗?)一个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”> ? ? […]