javascript¼Ì³Ð·½Ê½Ö®Ò»
ÃæÏò¶ÔÏóµÄÓïÑÔ¶àÊý¶¼Ö§³Ö¼Ì³Ð£¬¼Ì³Ð×îÖØÒªµÄÓŵã¾ÍÊÇ´úÂ븴Ó㬴Ӷø¹¹½¨´óÐÍÈí¼þϵͳ¡£Èç¹ûÒ»¸öÀàÄܹ»ÖØÓÃÁíÒ»¸öÀàµÄÊôÐԺͻò·½·¨£¬¾Í³Æ֮Ϊ¼Ì³Ð¡£
´ÓÕâ¸ö½Ç¶ÈÀ´¿´¿´jsµÄ¼Ì³Ð·½Ê½¡£jsÖм̳з½Ê½ÓëдÀ෽ʽϢϢÏà¹Ø¡£²»Í¬µÄдÀ෽ʽÔì³É²»Í¬µÄ¼Ì³Ð·½Ê½¡£¸÷ÖÖÁ÷ÐÐjs¿â¼Ì³Ð·½Ê½Ò²¸÷²»Ïàͬ¡£´Ó×î¼òµ¥µÄ
¸´ÓÿªÊ¼¡£
1¡¢¹¹Ô캯ÊýдÀ࣬ͨ¹ý·½·¨µ÷Óø´ÖƸ¸ÀàÊôÐÔ¸ø×ÓÀà
ʵÏּ̳Ð
ÕâÀ︸À࣬×ÓÀ඼Óù¹Ô캯Êý·½Ê½Ð´£¬²»ÓÃÔÐÍ¡£×ÓÀàµ÷Óø¸ÀຯÊýÀ´¸´ÖƸ¸ÀàµÄÊôÐÔ¡£
/**
* ¸¸ÀàPolygon:¶à±ßÐÎ
* @param {Object} sides
*/
function Polygon(sides) {
this.sides = sides;
this.setSides = function(s) {this.sides=s;}
}
/**
* ×ÓÀàTriangle:Èý½ÇÐÎ
*/
function Triangle() {
this.tempfun = Polygon;//¸¸ÀàÒýÓø³Öµ¸ø×ÓÀàµÄÒ»¸öÊôÐÔtempfun
this.tempfun(3);//µ÷ÓÃ
delete this.tempfun;//ɾ³ý¸ÃÊôÐÔ
this.getArea = function(){};
}
//new¸ö¶ÔÏó
var tri = new Triangle();
console.log(tri.sides);//¼Ì³ÐµÄÊôÐÔ
console.log(tri.setSides);//¼Ì³ÐµÄ·½·¨
console.log(tri.getArea);//×ÔÓеķ½·¨
//ȱµãÊǶÔÓÚTriangleµÄʵÀý¶ÔÏóÓÃinstanceofΪ¸¸ÀàPolygonʱÊÇfalse
console.log(tri instanceof Triangle);//true
console.log(tri instanceof Polygon);//false
ÒòΪjs¾ßÃûº¯ÊýÓÐËÄÖÖµ÷Ó÷½Ê½
£¬×ÓÀ໹¿ÉÒÔÓÐÒÔϵĶàÖÖʵÏÖ·½Ê½¡£Ö»ÊÇÔÚ×ÓÀàÖе÷Óø¸Àà·½·¨²»Í¬¶øÒÑ¡£
function Triangle() {
Polygon.call(this,3);//call·½Ê½µ÷Óø¸Àà
this.getArea = function(){};
}
function Triangle() {
Polygon.apply(this,[3]);//apply·½Ê½µ÷Óø¸Àà
this.getArea = function(){};
}
function Triangle() {
var temp = new Polygon(3);//new·½Ê½µ÷Óø¸Àà
for(atr in temp)//È«²¿¸´ÖƸø×ÓÀà
this[atr] = temp[atr];
this.getArea = function(){};
}
ÕâÖÖ·½Ê½µÄȱµãÊÇ×ÓÀàµÄʵÀý¶ÔÏóÓÃinstanceof¼ì²é¸¸Ààʱ×ÜÊÇfalse¡£ÕâÓëjavaÖм̳Ð"is a "µÄ¹ØϵÊÇÎ¥±³µÄ¡£
Ïà¹ØÎĵµ£º
phpÖеÄevalºÍJavaScriptÖеÄevalÇø±ð£º
Definition and Usage
¶¨ÒåºÍÓ÷¨
The eval() function evaluates a
string as PHP code.
eval()º¯ÊýµÄ×÷ÓÃÊÇ£º·µ»ØÓëPHP´úÂëÏà¶ÔÓ¦µÄ×Ö·û´®¡£
The string
must be valid PHP code and must end with semicolon.
Õâ¸ö×Ö·û´®±ØÐëÊÇÓÐЧµÄPHP´úÂ룬
²¢ÇÒ±ØÐëÒԷֺŽáÊø¡ ......
// µ÷ÓÃÒ³ÃæµÄˢз½·¨
IHTMLWindow2* pWindow;
IHTMLDocument2* pDocument;
HRESULT hr = GetDHtmlDocument(&pDocument);
hr = pDocument->get_pa ......
ÔÚWeb¿ª·¢ÖУ¬»áÓöµ½´ÓÒ»Ò³£¨¸¸Ò³£©µ¼ÏòÁíÒ»Ò³£¨×ÓÒ³£©£¬²¢ÇÒÒªÇó“·µ»Ø”¸¸Ò³µÄÇé¿ö£¬ÔÚÕâÀïÈç¹ûÓÃASP.NETÌṩµÄ Response.Redirect()·½·¨£¬ÍùÍù²»»á´ïµ½ÀíÏëµÄЧ¹û£¬ÀýÈ磺·µ»Øºó£¬ÖØмÓÔØÁËÒ³Ã棬ÎÞ·¨±£´æµ¼Ïò×ÓҳǰµÄ״̬£¬µÈµÈ£¬ÔÚÕâÀïÎҾͽéÉÜ Ò»ÏÂÈçºÎʹÓÃJavaScriptÖÐhistory.go()º¯ÊýÀ´ÊµÏÖ·µ»Ø ......
¹¦ÄÜ£º
ÖØмÓÔØÎĵµ¡£
Óï·¨£º
location.reload(force)
²ÎÊý£º
force£º¿ÉÑ¡²ÎÊý£¬ÊÇÒ»¸ö²¼¶ûÖµ¡£
Èç¹ûÊ¡ÂÔ²ÎÊý£¬»òÕß²ÎÊýÊÇfalse£¬Ëü¾Í»áÓÃHTTPÍ·If-Modified-SinceÀ´¼ì²â·þÎñÆ÷ÉϵÄÎĵµÊÇ·ñÒѸı䡣Èç¹ûÎĵµÒѸÄ
±ä£¬reload()»áÔÙ´ÎÏÂÔظÃÎĵµ¡£Èç¹ûÎĵµÎ´¸Ä±ä£¬Ôò¸Ã·½·¨½«´Ó»º´æÖÐ ......
Dynamic Scopes ¶¯Ì¬×÷ÓÃÓò
Both the with statement and the catch clause of a try-catch statement, as well as a function containing eval_r(), are all considered to be dynamic scopes. A dynamic scope is one that exists only through execution of code and therefore cannot be det ......