Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö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("123");
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="inp


Ïà¹ØÎĵµ£º

javascriptµØÖ·À¸Ð´·¨

javascriptµØÖ·À¸Ð´·¨
±¾µØ¿Í»§¶ËÈ«Ñ¡checkbox.¿ÉÒÔÓÃÕâ¸öÑ¡¡£
0. Ç°ÑÔ
ËùνIEµØÖ·À¸±í´ïʽ£¬¾ÍÊÇÔÚIEµÄµØÖ·À¸ÖÐÊäÈë javascript:<´úÂë>£¬Ö´ÐÐijЩ¹¦ÄÜ£¬À´¶¯Ì¬¸Ä±äÔ­ÓÐÒ³ÃæµÄ²ÎÊýÒԴﵽijЩĿµÄ£¬ÀýÈ翪·Å±»½ûÖ¹µÄ°´Å¥¡¢ÏÔʾԭ±¾Òþ²ØµÄͼƬµÈµÈ¡£±¾ÎĽ«¾ÍIEµØÖ·À¸µÄʹÓ÷½·¨×öÒ»¸öÏêϸµÄ˵Ã÷¡£
1. ±í´ïʽµÄÊéд· ......

eclipseÖÐjavascriptÏÔʾΪÂÒÂëµÄ½â¾ö°ì·¨¡£


eclipseÖÐjavascriptÏÔʾΪÂÒÂëµÄ½â¾ö°ì·¨¡£
Òà¿ÉÒÀ´ÎÑ¡Ôñ²Ëµ¥"window">>"preferences">>"general">>"content types"
ÔÚÓұߵĴ°¿ÚÖдò¿ªÁбí,Ñ¡ÖÐ"JavaScript",ÔÚÏÂÃæµÄ"default encoding"ÓұߵÄÊäÈë¿òÖÐÊäÈëjavaScript±àÂ룬Ҫ¿´ÄúµÄÍøÒ³ÓõıàÂ룬Èç¹ûÊÇ“GBK”¾ÍÑ¡"GBK",ÊÇ"GB2312"¾ ......

javascript CDATAµÄÒâÒå

CDATA ÄÚ²¿µÄËùÓж«Î÷¶¼»á±»½âÎöÆ÷ºöÂÔ¡£
¼ÙÈçÎı¾Öаüº¬ÁË´óÁ¿µÄ "<" ºÍ "&" ×Ö·û - ¾ÍÏñ±à³Ì´úÂëÖо­³£³öÏÖµÄÇé¿öÒ»Ñù - ÄÇôÕâ¸ö XML ÔªËؾͿÉÒÔ±»¶¨ÒåΪһ¸ö CDATA ²¿·Ö¡£
CDATA Çø¶Î¿ªÊ¼ÓÚ "<![CDATA["£¬½áÊøÓÚ "]]>"£º
<script type="text/javascript">
<![CDATA[
function compare(a,b) ......

event.keycode´óÈ«(javascript)

event.keycode´óÈ«(javascript)
keycode 8 = BackSpace BackSpace
keycode 9 = Tab Tab
keycode 12 = Clear
keycode 13 = Enter
keycode 16 = Shift_L
keycode 17 = Control_L
keycode 18 = Alt_L
keycode 19 = Pause
keycode 20 = Caps_Lock
keycode 27 = Escape Escape
keycode 32 = space space
......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ