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

ת javascriptʵÏÖ½Ó¿Ú

Ô­ÎĵØÖ·:http://www.cnblogs.com/harrychen66/archive/2008/10/10/488457.html
 javascriptʵÏÖ½Ó¿Ú
ÏàÐźܶàÈËÖ®ËùÒÔ¶ÔjavascriptûÓкøÐ,¿ÉÄÜÊÇÒòΪËüÌ«ËæÒâÁË,ÀýÈ綨Òå±äÁ¿¿ÉÒÔËæÒâµÄ¼Óvar,»òÕß²»¼Ó,ÿÌõÓï¾äºóÃæµÄ¿ÉÒÔËæÒâµÄ¼ÓÉÏ";",»òÕß²»¼Ó,¿ÉÄÜ×îÄÑÈÌÊܵÄÊÇ,varÁËÒ»¸ö±äÁ¿ºó,Ëü¿ÉÒÔÊÇÈκÎÀàÐÍ,ûÓÐÏÞÖÆ.
ÀýÈ綨ÒåÁËÒ»¸östrµÄ±äÁ¿
var str;
ûÓи³Öµ¸øËü,ËüÊÇÒ»¸ö"undefined"ÀàÐ͵ıäÁ¿
È»ºó:
str = "hello world!";
Ëü¾ÍÊÇÒ»¸östringÀàÐ͵ıäÁ¿,È»ºóÈç¹ûÄãϲ»¶,Äã¿ÉÒÔ³¢ÊÔÔٸıäËüµÄÀàÐÍ:
str = 1;
ÕâʱËü¾ÍÊÇÒ»¸önumberÀàÐÍÁË.
Èç´Ë¿íÈݵÄÀàÐͱ任,ÓÐʱȷʵ´øÀ´·½±ã,²»¹ýÄãÏëÒªËüÏóc#»òÕßÆäËûÓïÑÔÒ»ÑùÒªÑϸñµÄÀàÐ͹淶,Ò²ÊÇÓа취×öµ½µÄ,ÕâÀïÓÃÁËÀàËÆ.netµÄ½Ó¿ÚÌØÐÔ,²»¹ý½«ÒªËµµÄ·½·¨,²»ÄÜÔÚ"±àÒë"Öмì²é,Ö»ÄÜÔÚÔËÐÐʱ¼ì²éÀàÐÍ.
Ê×ÏÈÓÐÒ»¸ö´æÔÚµÄÀà:
function Person(){
    this.name = "";
    this.age = 0;
    this.get = function(){
      return "my name is " + this.name + ", and i am " + this.age + " years old";
    };
    this.set = function(name, age){
      this.name = name;
      this.age = age;
    };
}
ÕýÈ·µÄʹÓÃÈç:
var person = new Person();
person.set("harry", 27);
var str = person.get();
alert(str);
ÕýÈçÇ°Ãæ˵µÄ,Èç¹ûÊÇÏÂÃæµÄ×ö·¨Ò²ÊDz»»á³öÏÖÈκÎÎÊÌâµÄ:
person.setName(true, "hello");
ºÃÁË,Èç¹ûÏÖÔÚÄãÎÞ·¨ÈÌÊܳöÏÖÕâÑùµÄÇé¿ö,ÓýӿÚʵÏÖËü°É:
function interface(){
    this.arrFunc = [];    // ±£´æÕâ¸öÀàµÄ·½·¨Êý×é
    this.addMethod = function(sFuncName, aParamType, sReturnType){ // Ìí¼Ó½Ó¿ÚµÄ·½·¨
        this.arrFunc[this.arrFunc.length] = {funcName:sFuncName, param:aParamType, ret:sReturnType}; // ·½·¨Ãû³Æ,²ÎÊýÀàÐÍ,·µ»ØÀàÐÍ
    };
    this.set = function(obj){
        fo


Ïà¹ØÎĵµ£º

Ó¦ÓÃ×î¹ãµÄÊ®´óJavascript¿ò¼Ü

½üÈÕ£¬ÖªÃû¼¼Êõ¿ª·¢ÍøÕ¾SYS-CON ýÌåÁгöÊ®¸öÓ¦ÓÃ×î¹ãµÄjavascript¿ò¼Ü¡£ÎÄÕÂ˵£¬Javascript¿âÒѾ­³ÉΪÉè¼ÆÓÅÐãÍøÕ¾µÄ»ù´¡£¬µ±½ñ¼¸ºõËùÓÐÕ¾µã¶¼´øÓÐJavascript»òAjaxÔªËØ¡£ÔÚWeb2.0¿ª·¢´ó³±ÖУ¬ËüÒ²ÐíÊÇ×î¹Ø¼üµÄÒªËØ¡£
ÒÔÏÂÊ®´óJavascript¿ò¼Ü£¬Äã³£ÓÃÆäÖеļ¸¸ö?
1. script.aculo.us (http://script.aculo.us/)
  ......

JavaScript³£Ó÷½·¨×ܽᗗÍøÒ³³£ÓÃС¼¼ÇÉ

ÍøÒ³³£ÓÃС¼¼ÇÉ
1. oncontextmenu="window.event.returnValue=false" ½«³¹µ×ÆÁ±ÎÊó±êÓÒ¼ü
<table border oncontextmenu=return(false)><td>no</table> ¿ÉÓÃÓÚTable
2. <body onselectstart="return false"> È¡ÏûÑ¡È¡¡¢·ÀÖ¹¸´ÖÆ
3. onpaste="return false" ²»×¼Õ³Ìù
4. oncopy="return fa ......

JavaScript³£Ó÷½·¨×ܽᗗ¶ÔÏó Êý×é

B.1 anchor¶ÔÏó
¡¡¡¡Ê¹ÓÃ<A NAME=>±ê¼Ç´´½¨µÄhtmlÃèµãÄܱ»Ò»¸öÁ´½Ó×÷ΪĿ±êÈç¹ûêµã°üÀ¨HREF=ÌØÐÔ,ÔòËüÒ²ÊÇÒ»¸öÁ´½Ó¶ÔÏó¡£
¡¡¡¡anchor¶ÔÏóÊÇdocument¶ÔÏóµÄÒ»¸öÊôÐÔ,Ëü±¾ÉíûÓÐÊôÐÔ·½·¨»òÕßʼþ´¦Àí³ÌÐò¡£
¡¡¡¡B.2 anchorsÊý×é
¡¡¡¡anchorsÊý×éÊÇdocument¶ÔÏóµÄÒ»¸öÊôÐÔ,ÊÇÎĵµÄÚËùÓÐanchor¶ÔÏóµÄÒ»¸öÁбíÈç¹ ......

JavaScript³£Ó÷½·¨×ܽᗗÅжÏä¯ÀÀÆ÷ÀàÐÍ

ÅжÏä¯ÀÀÆ÷ÀàÐÍ
<SCRIPT language=javascript>
if(navigator.appVersion.indexOf("MSIE 6.") != -1 ){
window.location = "111.htm" ;
}
</SCRIPT>
°´Å¥±³¾°Í¼Æ¬Ìæ»»
<input type=button style="background-image:url(a.gif)" value=test onmouseover="this.style.backgroundImage='url(b.gif ......

JavaScriptµÄfunction

º¯ÊýÊǽøÐÐÄ£¿é»¯³ÌÐòÉè¼ÆµÄ»ù´¡£¬±àд¸´ÔÓµÄAjaxÓ¦ÓóÌÐò£¬±ØÐë¶Ôº¯ÊýÓиüÉîÈëµÄÁ˽⡣
¡¡¡¡javascriptÖеĺ¯Êý²»Í¬ÓÚÆäËûµÄÓïÑÔ£¬Ã¿¸öº¯Êý¶¼ÊÇ×÷Ϊһ¸ö¶ÔÏó±»Î¬»¤ºÍÔËÐеġ£Í¨¹ýº¯Êý¶ÔÏóµÄÐÔÖÊ£¬¿ÉÒԺܷ½±ãµÄ½«Ò»¸öº¯Êý¸³Öµ¸øÒ»¸ö±äÁ¿»òÕß½«º¯Êý×÷Ϊ²ÎÊý´«µÝ¡£ÔÚ¼ÌÐø½²Êö֮ǰ£¬ÏÈ¿´Ò»Ïº¯ÊýµÄʹÓÃÓï·¨£º
ÒÔÏÂÊÇÒýÓÃƬ¶Î ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ