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´úÂ룬
²¢ÇÒ±ØÐëÒԷֺŽáÊø¡ ......
<script>setTimeout("redirect('<?=$url_forward?>');", <?=$ms?>);</script>
ÉèÖ÷ÖÒ³£º$page $pagesize $offset = ($page-1)*$pagesize;
$limit = "limit $offset,$pagesize" ......
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 ......
µÚÈýÕ DOM Scripting DOM±à³Ì
DOM scripting is expensive, and it's a common performance bottleneck in rich web applications. This chapter discusses the areas of DOM scripting that can have a negative effect on an application's responsiveness and gives recommendations o ......
function db()
{
//»î¶¯±àºÅ
var activeid = Request.Form("activeid");
//Óû§Ãû
var username = Request.Form("username");
//ÊÖ»úºÅÂë
var mobile = Request.Form("mobile");
var conn= Server.CreateObject("ADODB.connection");
var rs= Serve ......