javascriptÖÐʵÏÖ¶ÁÈ¡Ö¸¶¨¸ñʽµÄÈÕÆÚ£¨format£©
javascript
µÄ±àÂëÄÜÁ¦±È½ÏÈõ£¬µ«²¢²»´úÂëËü²»ÄÜ×ö£¬Ö»²»¹ý£¬ÐèÒªÄ㻨һµã¹¦·ò£¬Ç°¶Îʱ¼äÔÚ×öÈÕÀúµÄʱºò£¬ÐèÒª´Ótextbox¶ÁÈ¡ÈÕÆÚ£¬ÎÊÌâµÄ¹Ø¼üÊÇtextbox
µÄÈÕÆÚ¿ÉÄÜÊÇÃÀ¹ú±ê×¼£¬¿ÉÄÜÊÇÖйú±ê×¼µÈµÈ£¬Ã»Óа취½«Ö®×ª³ÉÈÕÆÚ¸ñʽ£¬Ò²¾Í²»Äܽ«ÈÕÆÚÔÚÈÕÀúÖж¨Î»µ½µ±Ìì¡£ÔÚcsdnÉÏÎÊÁËÒ»¸öÎÊÌ⣬½á¹ûûÓÐÈË´ðµÃºÏ
ÊÊ£¬ÎÒÒ»Å֮ϣ¬×Ô¶ùдÁËÒ»¸ö£¬»¹ÐУ¬ÄÜÓá£
˵˵ÐèÇó°É£¬»ù±¾ÉϺܼòµ¥£¬¾ÍÊÇÄÜʶ±ðyyyymmdd¼°yymdÕâÑùµÄÈÕÆÚ¸ñʽ£¬»òÕßyy¡¢yyyy¡¢M¡¢MM¡¢d¡¢ddµÄÈÎÒâ×éºÏ¡£ÈçyyyyÄêMM
ÔÂddÈÕ£¬Æ¥Åä2009Äê06ÔÂ10ÈÕ¡£
ÏÈ¿´´úÂë°É£º
//½«×Ö·û´®×ª»»ÎªÈÕÆÚ
String.prototype
.toDate
=
function
(
format)
{
pattern =
format.replace
(
"yyyy"
,
"(\~
1{4})"
)
.replace
(
"yy"
,
"(\~
1{2})"
)
.replace
(
"MM"
,
"(\~
1{2})"
)
.replace
(
"M"
,
"(\~
1{1,2})"
)
.replace
(
"dd"
,
"(\~
1{2})"
)
.replace
(
"d"
,
"(\~
1{1,2})"
)
.replace
(
/~1/g
,
"d"
)
;
var
returnDate;
if
(
new
RegExp(
pattern)
.test
(
this
)
)
{
var
yPos =
format.indexOf
(
"yyyy"
)
;
var
mPos =
format.indexOf
(
"MM"
)
;
var
dPos =
format.indexOf
(
"dd"
)
;
if
(
mPos ==
-
1
)
mPos =
format.indexOf
(
"M"
)
;
if
(
yPos ==
-
1
)
yPos =
format.indexOf
(
"yy"
)
;
if
(
dPos ==
-
1
)
dPos =
format.indexOf
(
"d"
)
;
var
pos =
new
Array(
yPos +
"y"
,
mPos +
"m"
,
dPos +
"d"
)
.sort
(
)
;
var
data =
{
y:
0
,
m:
0
,
d:
0
}
;
var
m =
this
.match
(
pattern)
;
for
(
var
i =
1
;
i &
lt;
m.length
;
i++
)
{
Ïà¹ØÎĵµ£º
ÓÃJavascriptʵÏÖ¸ù¾ÝÏÂÀÁбícategoryµÄÑ¡Ôñ½á¹û£¬¸Ä±äÏÂÀÁбísub_categoryµÄÑ¡Ïî
<mce:script language="javascript" type="text/javascript">
<!--
function changeSubCategory() {
var sel_category = document.getElementById("category");
var sel_sub_category = document.getElementById("sub_c ......
¸ÐлÈñÉÌÆóÒµCMSµÄͶµÝ
ÐÂÎÅÀ´Ô´:Smashing Magazine
JavaScript µÄ³É¹¦ÈÃÈ˽ò½òÀÖµÀ£¬Îª Web ÍøÒ³±àд JavaScript ´úÂëÒѾÊÇËùÓÐ Web Éè¼ÆʦµÄ»ù±¾¹¦£¬ÕâÃÅÓÐȤµÄÓïÑÔÔ̲Ø×ÅÐí¶à²»ÎªÈËÊìÖªµÄ¶«Î÷£¬¼´Ê¹¶àÄêµÄ JavaScript ³ÌÐòÔ±£¬Ò²Î´ÄÜÍêÈ«³Ô͸¡£±¾ÎÄ´Ó7¸ö·½Ãæ½²Êö JavaScript ÖÐÄÇЩÄã²»ºÜÊìÖªµ«·Ç³£ÊµÓõļ¼ÇÉ¡£
¼òÂ ......
Javascript ÔÐͺͼ̳Ð(Prototypes and Inheritance) ÊÕ²Ø
Ç°ÃæÎÒÃÇ¿´µ½ÁËÈçºÎʹÓà constructor À´³õʼ»¯¶ÔÏó¡£Èç¹ûÕâÑù×ö£¬ÄÇôÿһ¸ö´´½¨µÄжÔÏ󶼻á¶ÔÄÇЩÏàͬµÄÊôÐÔ£¬·½·¨½¨Á¢Ò»¸ö¶ÀÁ¢µÄ¸±±¾¡£¶øʵ¼ÊÉÏÓиü¼ÓÓÐЧµÄ·½·¨À´Ö¸¶¨·½·¨£¬³£Á¿£¬ÒÔ¼°ÆäËûһЩ¿É±»ËùÓиÃÀàµÄ¶ÔÏó¹²ÏíµÄÊôÐÔ¡£
JavaScript ¶ÔÏó´ÓÒ»¸ö ......
¼ÇµÃ´óÒ»µÄʱºò£¬ÎÒÃÇרҵ¿ªÁËÍøÒ³Éè¼ÆÕâÃſγ̣¬ÄÇʱ£¬¿´×ÅÊéÉϵļòµ¥¼¸ÐдúÂë²úÉúµÄJSÌØЧ£¬ºÜÕ𾪣¬¾Íϲ»¶ÉÏÁËjs½Å±¾ÓïÑÔ£¬ºÃËÆÈËÃdz£ËµµÄÒ»¼ûÖÓÇé°É¡£¾ªÑÞÓÚËýÇ¿´óµÄ¹¦ÄÜ¡£¿ÉÊÇ£¬¶ÔÓÚ£ê£ó,Ö»ÄÜÓÃÒź¶À´ÐÎÈݵ±Ê±ÎÒµÄÐÄÇé¡£µ±Ê±£¬ÀÏʦֻÊÇΪ¸Ï½ø¶È£¬Íê³ÉËùνµÄѧԺ²¼ÖõĽÌѧÈÎÎñ£¬×øÔÚ¶àýÌåµçÄÔÇ°£¬ ......
JavaScript µÄ³É¹¦ÈÃÈ˽ò½òÀÖµÀ£¬Îª Web ÍøÒ³±àд JavaScript ´úÂëÒѾÊÇËùÓÐ Web Éè¼ÆʦµÄ»ù±¾¹¦£¬ÕâÃÅÓÐȤµÄÓïÑÔÔ̲Ø×ÅÐí¶à²»ÎªÈËÊìÖªµÄ¶«Î÷£¬¼´Ê¹¶àÄêµÄ JavaScript ³ÌÐòÔ±£¬Ò²Î´ÄÜÍêÈ«³Ô͸¡£±¾ÎÄ´Ó7¸ö·½Ãæ½²Êö JavaScript ÖÐÄÇЩÄã²»ºÜÊìÖªµ«·Ç³£ÊµÓõļ¼ÇÉ¡£
¼òÂÔÓï¾ä
JavaScript ¿ÉÒÔʹÓüòÂÔÓï¾ä¿ìËÙ´´½¨¶ÔÏóºÍÊý× ......