javascriptµÄdelete
¸Õ¸Õ°Ý¶ÁÁË JavascriptµÄ±äÁ¿Óëdelete²Ù×÷·û ºÜÊÜÆô·¢¡£ÔÎÄֻ˵Á˽á¹û£¬Ã»¸üÉîÈëÍÆÀí×ܽáÒ»ÏÂΪʲô£¬ÒÔ¼°ÔõôÀí½âºÃÒ»µã£¬ÎÒÕâÀï²¹³ä×ܽáһϡ£
/// <reference path="http://tech.idv2.com/2008/01/09/javascript-variables-and-delete-operator/" />
/*
Óëc++²»Í¬£¬javascriptµÄdelete²»»áɾ³ýÊôÐÔËùÖ¸ÏòµÄ¶ÔÏó
“ɾ³ýÊôÐÔ¶ø²»ÊÇɾ³ý¶ÔÏó”ÕâÒ»µã£¬¿ÉÒÔͨ¹ýÒÔϵĴúÂëÀ´È·ÈÏ¡£
*/
var o = {};
var a = { x: 10 };
o.a = a;
delete o.a; // o.aÊôÐÔ±»É¾³ý
o.a; // undefined
a.x; // 10, ÒòΪ{ x: 10 } ¶ÔÏóÒÀÈ»±» a ÒýÓã¬ËùÒÔ²»»á±»»ØÊÕ
/*
ÊôÐÔdelete**½áÂÛ£ºdeleteɾ³ý¶ÔÏóʵÀýµÄÊôÐÔ Ö»¶Ô¶ÔÏóʵÀý²Ù×÷,²»»áÓ°Ïìµ½ËûµÄÀàÐͺÍÔÐÍ
*/
function C() { this.x = 42; } //¹¹Ô캯Êý¡£
C.prototype.x = 12; //¸øoµÄÔÐͶÔÏóÌí¼ÓÊôÐÔx£¬ËùÒÔ²»»á±»delete¡£
var o = new C(), d = new C();
alert(o.prototype); //ÏÔʾundefined£¬ÒòΪÆäʵֻÓк¯Êý²ÅÓÐprototypeÊôÐÔ
//alert(C.prototype.isPrototypeOf(o));
alert(o.x); // 42, ¹¹Ô캯ÊýÖж¨ÒåµÄo.x
delete o.x; // deleteɾ³ýÊôÐÔ Ö»¶Ô¶ÔÏóʵÀý²Ù×÷,²»»áÓ°Ïìµ½ËûµÄÔÐÍ
alert(o.x); // 12 ÔÚ×ÔÉíÉÏÕÒ²»µ½x£¬¾Í»á²éÕÒÔÐÍÁ´¡£
alert(d.x); // 42 ÒòΪֻɾÁËʵÀýoµÄxÊôÐÔ£¬²¢Ã»É¾ÊµÀýdµÄxÊôÐÔ£¬ÕâÀï²»»áÏÔʾundefined
/*
²âÊÔ±äÁ¿delete**½áÂÛ£ºÍ¨¹ývarÉùÃ÷µÄ±äÁ¿ºÍͨ¹ýfunctionÉùÃ÷µÄº¯ÊýÓµÓÐDontDeleteÌØÐÔ£¬
ÎÞ·¨±»É¾³ý¡£Èç¹ûÄãÔø¾ÓñհüÄ£Äâ¹ýÀàµÄ˽ÓÐÊôÐÔ¡¢·½·¨£¬ÄÇÒ²¿ÉÒÔÕâÑùÀí½â£¬Í¨¹ývarºÍ
functionÉùÃ÷µÄ±äÁ¿ºÍÓÐÃûº¯Êý£¬¶¼ÊÇ¿ÉÒÔ¿´×öÀàµÄ˽ÓеijÉÔ±£¬Ë½ÓгÉÔ±¾ßÓÐDontDeleteÌØÐÔ¡£
*/
var a = 1;
delete a;
b = 2; //ûÓÐÓÃvar£¬¿ÉÒÔÀí½âĬÈÏΪ¹«ÓеÄÊôÐÔ£¬¿ÉÒÔ±»É¾³ý
delete b;
alert(typeof b); //undefinded£¬±»É¾ÁË
function foo() {//È«¾Ö¶ÔÏóµÄ˽Óз½·¨
return 42;
}
delete foo;
alert(foo()); // 42
function foo1() {
var local = 36;
delete local; // ɾ³ýlocal£¬ºÜÏÔÈ»localÊÇ˽ÓгÉÔ±£¬Ã»É¾µô
alert(local);
}
foo1();
/*
evalºÍdelete**½áÂÛ£ºeval±È½ÏÌØÊ⣬²Î¿¼
http://tech.idv2.com/2008/01/09/javascript-variables-and-delete-operator/#content_2_4
*/
eval("var x = 36;"); //×¢Ò⣺evalÊÜ×÷ÓÃÓòÓ°Ï죬¸ü¶à²Î¿¼htt
Ïà¹ØÎĵµ£º
scrollHeight: »ñÈ¡¶ÔÏóµÄ¹ö¶¯¸ß¶È¡£
scrollLeft:ÉèÖûò»ñȡλÓÚ¶ÔÏó×ó±ß½çºÍ´°¿ÚÖÐÄ¿Ç°¿É¼ûÄÚÈݵÄ×î×ó¶ËÖ®¼äµÄ¾àÀë
scrollTop:ÉèÖûò»ñȡλÓÚ¶ÔÏó×¶ËºÍ´°¿ÚÖпɼûÄÚÈݵÄ×¶ËÖ®¼äµÄ¾àÀë
scrollWidth:»ñÈ¡¶ÔÏóµÄ¹ö¶¯¿í¶È
offsetHeight:»ñÈ¡¶ÔÏóÏà¶ÔÓÚ°æÃæ»òÓɸ¸×ø±ê offsetParent ÊôÐÔÖ¸¶¨µÄ¸¸×ø±êµÄ¸ß¶È
offsetL ......
·¢ÏÖΪ±¾ÎÄÆðÒ»¸öºÏÊʵıêÌ⻹²»ÊÇÄÇôÈÝÒ×£¬ºÇºÇ£¬ËùÒÔÔÚ´ËÏÈ˵Ã÷ϱ¾ÎĵÄÁ½¸öÄ¿µÄ£º
£¨1£©½éÉÜjavascriptÖеÄevalº¯ÊýµÄÓ÷¨
£¨2£©ÈçºÎÔÚº¯ÊýÄÚÖ´ÐÐÈ«¾Ö´úÂë
►ÏÈÀ´ËµevalµÄÓ÷¨£¬ÄÚÈݱȽϼòµ¥£¬ÊìϤµÄ¿ÉÒÔÌø¹ý¡£
evalº¯Êý½ÓÊÕÒ»¸ö²ÎÊýs£¬Èç¹ûs²»ÊÇ×Ö·û´®£¬ÔòÖ±½Ó·µ»Øs¡£·ñÔòÖ´ÐÐsÓï¾ä¡£Èç¹ûsÓï¾äÖ´Ðнá¹ûÊÇÒ»¸ö ......
1.asp.netºô½Ðjs
Response.Write("<script language=javascript>");
......
½üÀ´¿´ÁËDeanµÄ“Convert any colour value to hex in MSIE”£¬ÖÕÓÚ½â¾öÁ˸ù¾Ý¹Ø¼ü×Ö»ñÈ¡ÑÕÉ«rgbÖµµÄÎÊÌâ¡£
˳±ã°Ñ³ÌÐòÒ²ÖØÐÂÕûÀíÒ»·¬£¬²¢Ê¹ÓÃÁË×î½üÕûÀíµÄ¹¤¾ß¿â¡£
Ч¹ûÔ¤ÀÀµ½ÕâÀï
ÏÂÔØÍêÕûʵÀý
³ÌÐò˵Ã÷
¡¾ColorGradsÑÕÉ«Ìݶȡ¿
³ÌÐòColorGradsµÄ×÷ÓÃÊǸù¾ÝÑÕÉ«¼¯ºÏºÍ½¥±ä¼¶ÊýÉú³ÉÑÕÉ«Ìݶȼ¯ºÏ¡£
½¥±ä¼ ......