Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

javascriptÖÐÈÕÆÚº¯ÊýDateÏê½â

¶ÔÏó: ÈÕÆÚ
DateÊÇjavascriptÔ¤¶¨ÒåÖ÷Ìâ. ¸ÃÖ÷Ìâ°üÀ¨¿É»ñÈ¡»òÉèÖÃϵͳÈÕÆÚ¡¢Ê±¼ä¡¢Ô¡¢ÈÕ¡¢Ð¡Ê±¡¢·ÖÖÓ¡¢ÃëµÈµÈ¡£°üÀ¨º¯Êý·½·¨»ñÈ¡ UTC ¸ñʽµÄÈÕÆÚ¡£ UTC Êǹú¼Ê±ê׼ʱ¼ä£¬Ò²³Æ¸ñÁÖÄáÖαê׼ʱ¼ä£¨Greenwich Mean Time£©¡£
ÔÚʹÓÃÕâЩ·½·¨Ç°¿ÉÏÈÉùÃ÷Ò»¸öÖ÷Ìâ¡£
´´½¨ÐÂÈÕÆÚÖ÷Ìâ
ʾÀý´úÂ룺var exd = new Date();
µ÷ÓÃ"new Date()" ½«´´½¨Ò»¸öÈÕÆÚÖ÷Ìâ¡£¸ÃÖ÷Ìâ¿ÉÓÃÓÚµ÷Óùý³Ì»òº¯Êý¡£ÎÒÃDZØÐëÔÚ±äÁ¿ÖлñÈ¡¸ÃÖ÷Ìâ¡£ÔÚÉÏÊöʾÀý´úÂëÖиÃÖ÷Ìâ´æ´¢ÓÚ±äÁ¿ exd ÖС£
ÒÔϽ«Ê¹Óà exd ×÷ΪʾÀý¡£
·½·¨
ʾÀý´úÂë
½á¹û
˵Ã÷
getDate()
exd = new Date();
exd.getDate();
23 9
getDate() ·½·¨·µ»ØÄúµ±Ç°ÏµÍ³ÈÕÆÚÖеÄÌìÊý¡£ Æ䷶ΧΪ 1 µ½ 31¡£
getUTCDate()
exd = new Date();
exd.getUTCDate();
23 9
getUTCDate() ·½·¨·µ»Ø UTC ÈÕÆÚÖеÄÌìÊý¡£ UTC Êǹú¼Ê±ê׼ʱ¼ä¡£
getMonth()
exd = new Date();
exd.getMonth();
3 3
getMonth() ·½·¨·µ»ØÄúϵͳÈÕÆÚÖеÄÔ·ݡ£ Æ䷶ΧÊÇ´Ó 1 µ½ 12. 1 ÊÇ1Ô£¬ 12 ÊÇ12Ô¡£
getUTCMonth()
exd = new Date();
exd. getUTCMonth();
3 3
getUTCMonth() ·½·¨·µ»ØÄúϵͳÈÕÆÚÖÐµÄ UTC ʱ¼äÖеÄÔ·ݡ£
getDay()
exd = new Date();
exd.getDay();
5 5
getDay() ·½·¨·µ»ØÄúϵͳÈÕÆÚΪһÖÜÖеÄÐÇÆÚ¼¸¡£ Æä·µ»Ø·¶Î§Îª´Ó 1 µ½ 7. 1 ΪÐÇÆÚÈÕ, 2 ÊÇÐÇÆÚÒ», µ½ 7 ΪÐÇÆÚÁù¡£
getUTCDay()
exd = new Date();
exd.getUTCDay();
5 5
getUTCDay() ·½·¨·µ»ØÄúϵͳ UTC ÈÕÆÚÊÇÒ»ÖÜÖеÄÐÇÆÚ¼¸¡£
getHours()
exd = new Date();
exd.getHours();
14 20
getHours() ·½·¨·µ»ØÄúϵͳÈÕÆÚµÄСʱ¡£ ¸Ã·¶Î§ÊÇ 0 µ½ 24.
getUTCHours()
exd = new Date();
exd.getUTCHours();
6 12
getUTCHours() ·½·¨·µ»ØÄúϵͳ UTC ÈÕÆÚµÄСʱ¡£ [Öйúʱ¼ä±È¹ú¼Ê±ê׼ʱ¼ä£¨UTC£©¿ì 8 Сʱ].
getMinutes()
exd = new Date();
exd.getMinutes();
2 32
getMinutes() ·½·¨·µ»ØÄúϵͳÈÕÆڵķÖÖÓ¡£ Æä½á¹û·¶Î§ÊÇ 0 µ½ 59¡£
getUTCMinutes()
exd = new Date();
exd. getUTCMinutes();
2 32
getUTCMinutes() ·½·¨·µ»ØÄúϵͳ UTC ÈÕÆڵķÖÖÓ¡£
getSeconds()
exd = new Date();
exd.getSeconds();
1 30
getSeconds() ·½·¨·µ»ØÄúϵͳÈÕÆڵķÖÖÓ¡£ Æä½á¹û·¶Î§ÊÇ 0 µ½ 59¡£
getUTCSeconds()
exd = new Date();
exd. getUTCSeconds();
1 30
getUTCSeconds() ·½·¨·µ»ØÄúϵͳ UTC ÈÕÆÚµÄÃëÖÓ¡£
getMilliseconds()
exd


Ïà¹ØÎĵµ£º

JavascriptÌøת´óÈ«

°´Å¥Ê½£º
<INPUT name="pclog" type="button" value="/GO" onClick="location.href='http://game.unimagic.cn'">
Á´½Óʽ£º
<a href="javascript:history.go(-1)">·µ»ØÉÏÒ»²½</a>
<a href="<%=Request.ServerVariables("HTTP_REFERER")%>">·µ»ØÉÏÒ»²½</a>
Ö±½ÓÌøתʽ£º
<scrip ......

javascriptÕýÔò±í´ïʽʵÏÖtrim()ÒÉ»ó

ÕýÔÚ¿´¡¡javascript¸ß¼¶³ÌÐòÉè¼Æ¡¡,ÆäÖйØÓÚ·Ö×éÀïÃæµÄÒ»¾ä´úÂë²»ÊÇÌ«Àí½â:
ͨ¹ýÅäºÏʹÓÃString¶ÔÏóµÄreplace()·½·¨¼°·´ÏòÒýÓ㬾ͿÉÒÔ¶¨Òå×Ô¼ºµÄtrim()·½·¨:
String.prototype.trim = function() {
var reExtraSpace = /^\s+(.*?)\s+$/;
return this.replace(reExtraSpace,"$1");
}
 
Ò»¿ªÊ¼ÔõôҲ²» ......

JavascriptÖÐShowModalDialog¹¦ÄÜ

ShowModalDialogº¯ÊýµÄ¹¦ÄÜ£º
´ò¿ªÒ»¸ö×Ó´°¿Ú£¬²¢ÇÒ¿ÉÓ븸´°¿ÚÏ໥´«µÝÊý¾Ý£¬ËüÓëwindow.openµÄ×î´óÇø±ð¾ÍÔÚÓÚÓÉShowModalDialog´ò¿ª×Ó´°¿Úºó£¬¸¸´°¿Ú½«²»ÄܲÙ×÷¡£
ʹÓ÷½·¨£º
vReturnValue = window.showModalDialog(sURL [, vArguments] [, sFeatures])
²ÎÊý˵Ã÷£º
sURL
±ØÑ¡²ÎÊý£¬ÀàÐÍ£º×Ö·û´®¡£ÓÃÀ´Ö¸¶¨¶Ô»°¿òÒªÏ ......

asp.net¶¯Ì¬×¢²ájavascript×ܽá

Ò».ʹÓÃRegisterStartUpScript×¢²áÖ»Ö´ÐÐÒ»´ÎµÄjavascript
µÚ1²½(´´½¨²¢×¢²á²¢Ê¹ÓÃjavascript)£ºPage.aspx.cs
protected void Page_Load(object sender, EventArgs e)
{
//´´½¨JavaScript
string info = "<mce:script type="text/javascript"><!--alert('ÄãºÃ£¬ÎÒÊÇXXX£¡')// --></mce:scrip ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ