JavaScriptÏÞÖÆtextarea³¤¶È
ÓÉÓÚTEXTAREAûÓÐmaxlength,²»ÄÜÕâÑùÏÞÖÆtextarea³¤¶È£¬ µ«Í¨¹ýJAVASCRIPT ¾ÍÄÜʵÏÖµ½
<mce:script type="text/javascript"><!--
function limitLength(obj, length) {
var desc = obj.value;
obj.value = substr(obj.value,length);
}
function substr(str,length){
var l=0,i=0;
while(l <length && i<str.length){
l+=1;
if(str.substring(i,i+1).match(/[\u4e00-\u9fa5]/))l+=2;//Ò»¸öÖÐÎÄÊÇÏ൱ÓÚ3¸öÓ¢ÎÄ
i+=1;
}
return str.substring(0,i);
}
// --></mce:script>
<textarea name="blogdesc" cols="50" rows="5" onkeyup="limitLength(this,200)">»Ð»Ðã±ã±»Ð»Ðã±ã±»Ð»Ðã±ã±ºÍ
ÊDz»ÊǺܼòµ¥£¿
Ïà¹ØÎĵµ£º
1.ÉùÃ÷Ò»¸öDateʱ¼ä¶ÔÏóµÄ·½Ê½ÓÐÒÔÏÂÈýÖÖ
Date()£º±íʾ¹¹ÔìÒ»¸öµ±Ç°ÏµÍ³Ê±¼ä¶ÔÏó
Date(int year,int month,int day)£º¹¹ÔìµÄʱ¼ä¶ÔÏóËùÖ¸ÏòµÄʱ¼äΪ Ä꣺1900+year;Ô£ºmonth+1;ÈÕ£ºday;ʱ,·Ö,Ã룺00
Date(int millsecond)£º¹¹ÔìµÄʱ¼ä¶ÔÏó ......
ʵÀýÈçÏ£ºjavascript.htmlÎļþ
<html>
<head>
<title>JavaScriptÑéÖ¤</title>
</head>
<script language='JavaScript'>
......
½ñÌìżȻ¿´µ½ÁËconstructorÕâ¸ö¶«¶«£¬²»Ã÷°×ÓÃ;¡£Õҵ㶫Î÷±¸Íü
typeofº¯ÊýµÄÓ÷¨¿ÉÄܲ»ÓÃÎÒ¶à˵£¬´ó¼Ò¶¼ÖªµÀÔõôÓ᣶øconstructorÊôÐÔ´ó¼Ò¿ÉÄܾÍİÉúµã¡£ÔÚ¡¶¾«Í¨JavaScript¡·Õâ±¾ÊéÖÐÓÐÌáµ½constructµÄÓ÷¨£¬µ«ÎÒÓÃ×Ô¼ºµÄ¼¸¸öä¯ÀÀÆ÷£¨IE7.0 / Firefox1.9 / Opera9.50£©²âÊԵĽá¹ûÈ´ºÍÊéÉÏ˵µÄ²»Ò»Ñù¡£µ«ÊÇÈÔÈ»ÊÇÓÐ°ì·¨Í ......
1£¬²»´ø²ÎÊýµÄʼþ£º
Á½ÖÖ·½Ê½£ºÖ±½Ó¸ø¶ÔÏóÌí¼Óʼþ,½ÚµãÌí¼Óʼþ
ÀýÈç¸øÒ»¸öidΪtab1µÄÌí¼Óonclickʼþ
µÚÒ»ÖÖÇé¿ö£º
var
t
=
document.getElementById(
"
NewTitle
"
);
t.onclick
=
function
showmsg(){
alert(
'
Hello!Wor ......
Beginning JavaScript with Dom Scripting and Ajax
ÉîÈëdz³öJavaScript
ͼÁé³ÌÐòÉè¼Æ´ÔÊé
web¿ª·¢ÏµÁÐ
×÷Õß Christian Heilmann [µÂ]
µÚÒ»Õ JavaScriptÈëÃÅ
±¾ÕÂÖ÷Òª½éÉÜ£º
* JavaSriptÊÇʲôÒÔ¼°ËüµÄ¹¦ÓÃ
......