JavaScriptÖеÄDate¶ÔÏó
1.ÉùÃ÷Ò»¸öDateʱ¼ä¶ÔÏóµÄ·½Ê½ÓÐÒÔÏÂÈýÖÖ
Date()£º±íʾ¹¹ÔìÒ»¸öµ±Ç°ÏµÍ³Ê±¼ä¶ÔÏó
Date(int year,int month,int day)£º¹¹ÔìµÄʱ¼ä¶ÔÏóËùÖ¸ÏòµÄʱ¼äΪ Ä꣺1900+year;Ô£ºmonth+1;ÈÕ£ºday;ʱ,·Ö,Ã룺00
Date(int millsecond)£º¹¹ÔìµÄʱ¼ä¶ÔÏóËùÖ¸ÏòµÄʱ¼äΪ1970Äê1ÔÂ1ÈÕ08ʱ00·Ö00Ãë+millsecondºÁÃëËùµÃµÄʱ¼ä
2.Date¶ÔÏó³£Óõķ½·¨
getYear()£º»ñÈ¡"µ±Ç°¶ÔÏóËùÖ¸ÏòµÄÄê·Ý-1900"ËùµÃµÄÄê·Ý
getMonth()£º»ñÈ¡"µ±Ç°¶ÔÏóËùÖ¸ÏòµÄÔ·Ý-1"ËùµÃµÄÔ·Ý
getDate()£º»ñÈ¡µ±Ç°¶ÔÏóµÄÈÕÆÚ
getDay()£º»ñÈ¡µ±Ç°¶ÔÏóµÄÈÕÆÚ
getHours()£º»ñÈ¡µ±Ç°¶ÔÏóµÄСʱ
getMinutes()£º»ñÈ¡µ±Ç°¶ÔÏóµÄ·ÖÖÓ
getSeconds()£º»ñÈ¡µ±Ç°¶ÔÏóµÄÃëÖÓ
getTime()£º»ñÈ¡µ±Ç°Ê±¼ä¶ÔÏó¾àÀë1970Äê1ÔÂ1ÈյĺÁÃëÊý
setYear(int year)£º½«Äê·ÝÉèÖÃΪ1900+year
setMonth(int month)£º½«Ô·ÝÉèÖÃΪmonth+1
setDate(int date)£ºÉèÖÃÈÕÆÚ
setHours(int hour)£ºÉèÖÃСʱ
setMinutes(int minute)£ºÉèÖ÷ÖÖÓ
setSeconds(int second)£ºÉèÖÃÃëÖÓ
Ïà¹ØÎĵµ£º
<SCRIPT language=javaScript>
<!--
now = new Date(),hour = now.getHours()
if(hour < 6){document.write("Á賿ºÃ!")}
else if (hour < 9){document.write("ÔçÉϺã¡")}
else if (hour < 12){document.write("ÉÏÎçºÃ£¡")}
else if (hour < 14){document.write("ÖÐÎçºÃ£¡")}
else if (hour &l ......
ÍøÒ³³£ÓÃС¼¼ÇÉ
1. oncontextmenu="window.event.returnValue=false" ½«³¹µ×ÆÁ±ÎÊó±êÓÒ¼ü
<table border oncontextmenu=return(false)><td>no</table> ¿ÉÓÃÓÚTable
2. <body onselectstart="return false"> È¡Ïûѡȡ¡¢·ÀÖ¹¸´ÖÆ
3. onpaste="return false" ²»×¼Õ³Ìù
4. oncopy="return fa ......
B.1 anchor¶ÔÏó
¡¡¡¡Ê¹ÓÃ<A NAME=>±ê¼Ç´´½¨µÄhtmlÃèµãÄܱ»Ò»¸öÁ´½Ó×÷ΪĿ±êÈç¹ûêµã°üÀ¨HREF=ÌØÐÔ,ÔòËüÒ²ÊÇÒ»¸öÁ´½Ó¶ÔÏó¡£
¡¡¡¡anchor¶ÔÏóÊÇdocument¶ÔÏóµÄÒ»¸öÊôÐÔ,Ëü±¾ÉíûÓÐÊôÐÔ·½·¨»òÕßʼþ´¦Àí³ÌÐò¡£
¡¡¡¡B.2 anchorsÊý×é
¡¡¡¡anchorsÊý×éÊÇdocument¶ÔÏóµÄÒ»¸öÊôÐÔ,ÊÇÎĵµÄÚËùÓÐanchor¶ÔÏóµÄÒ»¸öÁбíÈç¹ ......
<script>
function getCookieVal(offset) {
var endstr = document.cookie.indexOf(";",offset);
if(endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset,endstr));
}
function FixCookieDate(data) {
var ba ......
ÀûÓÃjsÀ´¶¯Ì¬´´½¨±í¸ñÓÐÁ½ÖÖ¸ñʽ£¬appendChild()ºÍinsertRow¡¢insertCell()¡£Á½ÖÖ·½Ê½Æäʵ²î²»¶à£¬µ«µÚÒ»ÖÖÓпÉÄÜÔÚIEÉÏÓÐÎÊÌ⣬ËùÒÔÍÆ¼ö´ó¼ÒʹÓõڶþÖÖÁË£¬Ö±½Ó˵°É¡£
1¡¢inserRow()ºÍinsertCell()º¯Êý
insertRow()º¯Êý¿ÉÒÔ´ø²ÎÊý£¬ÐÎʽÈçÏ£º
insertRow(index)£ºindex´Ó0¿ªÊ¼
Õâ¸öº¯Êý½«ÐÂÐÐÌí¼Óµ½indexµÄÄÇÒ»ÐÐÇ ......