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

Javascript±íµ¥ÑéÖ¤´óÈ«

1. ³¤¶ÈÏÞÖÆ
<script>
function test()
{
if(document.a.b.value.length>50)
{
alert("²»Äܳ¬¹ý50¸ö×Ö·û£¡");
document.a.b.focus();
return false;
}
}
</script>
<form name=a onsubmit="return test()">
<textarea name="b" cols="40" wrap="VIRTUAL" rows="6"></textarea>
<input type="submit" name="Submit" value="check">
</form>
2. Ö»ÄÜÊǺº×Ö
<input onkeyup="value="/oblog/value.replace(/[^\u4E00-\u9FA5]/g,'')">
3. Ö»ÄÜÊÇÓ¢ÎÄ
<script language=javascript>
function onlyEng()
{
if(!(event.keyCode>=65&&event.keyCode<=90))
event.returnvalue=false;
}
</script>
<input onkeydown="onlyEng();">
4. Ö»ÄÜÊÇÊý×Ö
<script language=javascript>
function onlyNum()
{
if(!((event.keyCode>=48&&event.keyCode<=57)||(event.keyCode>=96&&event.keyCode<=105)))
//¿¼ÂÇС¼üÅÌÉϵÄÊý×Ö¼ü
event.returnvalue=false;
}
</script>
<input onkeydown="onlyNum();">
5. Ö»ÄÜÊÇÓ¢ÎÄ×Ö·ûºÍÊý×Ö
<input onkeyup="value="/oblog/value.replace(/[\W]/g,"'') "onbeforepaste="clipboardData.setData
('text',clipboardData.getData('text').replace(/[^\d]/g,''))">
6. ÑéÖ¤ÓÊÏä¸ñʽ
<SCRIPT LANGUAGE=javascript RUNAT=Server>
function isEmail(strEmail) {
if (strEmail.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1)
return true;
else
alert("oh");
}
</SCRIPT>
<input type=text onblur=isEmail(this.value)>
7. ÆÁ±Î¹Ø¼ü×Ö(ÕâÀïÆÁ±Î***ºÍ****)
<script language="javascript1.2">
function test() {
if((a.b.value.indexOf ("***") == 0)||(a.b.value.indexOf ("****") == 0)){
alert(":)");
a.b.focus();
return false;}
}
</script>
<form name=a onsubmit="return test()">
<input type=text name=b>
<input type="submit" name="Submit" value="check">
</form>
8. Á½´ÎÊäÈëÃÜÂëÊÇ·ñÏàͬ
<FORM METHOD=POST ACTION="">
<input type="password" id="input1">
<input type="password" id="input2


Ïà¹ØÎĵµ£º

Îò͸JavaScript Ô­Öø£ºÀîÕ½(leadzen)

Ô­Öø£ºÀîÕ½(leadzen).ÉîÛÚ 2008-2-23
Òý×Ó
    ±à³ÌÊÀ½çÀïÖ»´æÔÚÁ½ÖÖ»ù±¾ÔªËØ£¬Ò»¸öÊÇÊý¾Ý£¬Ò»¸öÊÇ´úÂë¡£±à³ÌÊÀ½ç¾ÍÊÇÔÚÊý¾ÝºÍ´úÂëǧ˿ÍòÂÆµÄ¾À²øÖгÊÏÖ³öÎÞÏÞµÄÉú»úºÍ»îÁ¦¡£
    Êý¾ÝÌìÉú¾ÍÊÇÎľ²µÄ£¬×ÜÏë±£³Ö×Ô¼º¹ÌÓеı¾É«£»¶ø´úÂëÈ´ÌìÉú»îÆÃ£¬×ÜÏë¸Ä±äÕâ¸öÊÀ½ç¡£
  
Äã¿ ......

ÓÃJavaScriptÐÞ¸ÄÍøÒ³cssÑùʽ

ÓÃJavaScriptÐÞ¸ÄÍøÒ³Ñùʽ
Ò»¡¢¾Ö²¿¸Ä±äÑùʽ
·ÖΪ¸Ä±äÖ±½ÓÑùʽ£¬¸Ä±äclassNameºÍ¸Ä±äcssTextÈýÖÖ¡£ÐèҪעÒâµÄÊÇ£º
×¢Òâ´óСд
£º
javascript¶Ô´óСдʮ·ÖÃô¸Ð£¬className²»Äܹ»°Ñ“N”д³É“n”£¬cssTextÒ²²»Äܹ»°Ñ“T”д³É“t”£¬·ñÔòÎÞ·¨ÊµÏÖЧ¹û¡£
µ÷Ó÷½·¨
£º
Èç¹û¸Ä ......

javascriptµÄÈÕÆÚÀý×Ó

<script language="JavaScript">
<!--
calendar = new Date();
day = calendar.getDay();
month = calendar.getMonth();
date = calendar.getDate();
year = calendar.getYear();
if (year< 100) year = 1900 + year;
cent = parseInt(year/100);
g = year % 19;
k = parseInt((cent - 17)/25);
i = ......

ÎÒÊÕ¼¯µÄjavascript documentÃüÁî

ÒýÓõØÖ·£ºhttp://bbs.syue.com/thread-36034-1-1.html
Ö±½ÓÔÚieµØÖ·À¸ÊäÈëÃüÁ»Ø³µ£¬Ö´ÐÐjs¡£
ÕâÑùÒ²¿ÉÒÔÓÃÀ´¸Ä±äºÍ»ñÈ¡ÔªËØµÄÖµºÍÊôÐÔ,ºÜʵÓõġ£
²é¿´cookie
javascript:alert(document.cookie)
Ö±½Ó±à¼­cookie
javascript:document.cookie=window.prompt("Linx Edit cookie:",document.cookie);void( ......

Javascript ѧϰ±Ê¼ÇÖ®ÒýÓÃ

ÒýÓÃÊÇÒ»¸öÖ¸Ïò¶ÔÏóʵ¼ÊλÖõÄÖ¸Õë¡£
Àý1£º
var obj = new Object();
var objRef = obj; //objÓëobjRefÖ¸Ïòͬһ¸ö¶ÔÏó,objRefÊÇÒ»¸öÒýÓÃ

×ÔÐ޸ģ¨self-modifying£©
Àý2£º
var items = new Array("one","two","three");
var itemsRef = items; //´´½¨Ò»¸öÒýÓÃ
items.push("four");
alert(items.length == items ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ