javascript¼Ì³Ð
ÓÃcall·½·¨ÊµÏּ̳Ð
function classA(sColor){
this.color=sColor;
this.sayColor=function(){
alert(this.color);
}
}
function classC(sColor,sName){
classA.call(this,sColor);
this.name=sName;
this.sayName=function(){
alert(this.name);
}
}
var obj1=new classC("red","jack");
obj1.sayColor();
obj1.sayName();
ÓÃapply·½·¨ÊµÏּ̳Ð
function classD(sColor,sName){
classA.apply(this,new Array(sColor));
this.name=sName;
this.sayName=function(){
alert(this.name);
}
}
var obj2=new classD("blue","sherry");
obj2.sayColor();
obj2.sayName();
¹¹Ô캯Êý£¬ÔÐÍ»ìºÏ·½·¨
function classA(sName){
this.name=sName;
}
classA.prototype.sayName=function(){
alert(this.name);
}
function classB(sName,sHeight){
classA.call(this,sName)
this.height=sHeight;
}
classB.prototype=new classA();
classB.prototype.sayHeight=function(){
alert(this.height);
}
var obj3=new classA("jack");
obj3.sayName();
var obj4=new classB("shrry",27);&nbs
Ïà¹ØÎĵµ£º
¡¡¡¡
¡¡¡¡»ù±¾²½Öè
¡¡¡¡1£¬°ÑÐèÒªÅÅÐòµÄÐзŵ½tbodyÖУ¨³ÌÐò»áÖ±½ÓÈ¡tbodyµÄrows£©£»
¡¡¡¡2£¬°ÑÅÅÐòÐзŵ½Ò»¸öÊý×éÖУ»
¡¡¡¡this.Rows = Map(this.tBody.rows, function(o){ return o; });
¡¡¡¡3£¬°´ÐèÇó¶ÔÊý×é½øÐÐÅÅÐò£¨ÓÃÊý×éµÄsort·½·¨£©£»
¡¡¡¡this.Rows.sort(Bind(this, this.Compare, orders, 0));
¡¡¡¡4£¬Ó ......
Ê×ÏÈ£¬ÔÚ¸÷¸öä¯ÀÀÆ÷ÖУ¬¶Ïµãµ÷ÊÔÖ§³ÖµÄ×îºÃµÄµ±È»ÊÇFirefox£¬Firefox²»½ö¿ÉÒÔʹÓÃFirebugµ÷ÊÔÒ³Ãæjs½Å±¾£¬»¹¿ÉÒÔÓø߼¶µ÷ÊÔ¹¤¾ßÀýÈçJavaScript Debugger (Venkman) À´µ÷ÊÔFirefoxÀ©Õ¹ÀïµÄjs¡£³ý´ËÖ®Í⣬Firefox»¹Ö§³ÖһЩ¸üΪ¸ß¼¶µÄ¶Ïµãµ÷ÊÔ¡¢±äÁ¿¼àÊÓ¹¦ÄÜ¡£
ÆäËûä¯ÀÀÆ÷ÀOpera¡¢ChromeºÍSafariµÄµ÷ÊÔ¹¦ÄÜÒ²±È½ÏºÃÓᣠ......
JavaScriptÒ³ÃæË¢ÐÂÓ뵯³ö´°¿ÚÎÊÌâ½â¾ö·½·¨
1.ÎÞÌáʾˢÐÂÍøÒ³
´ó¼ÒÓÐûÓз¢ÏÖ£¬ÓÐÐ©ÍøÒ³£¬Ë¢ÐµÄʱºò£¬»áµ¯³öÒ»¸öÌáʾ´°¿Ú£¬µã“È·¶¨”²Å»áˢС£
¶øÓеÄÒ³Ãæ²»»áÌáʾ£¬²»µ¯³öÌáʾ´°¿Ú£¬Ö±½Ó¾ÍË¢ÐÂÁË.
Èç¹ûÒ³ÃæÃ»ÓÐform£¬Ôò²»»áµ¯³öÌáʾ´°¿Ú¡£Èç¹ûÒ³ÃæÓÐform±íµ¥£¬
a)< form method="post" ...&g ......
jsÑéÖ¤±íµ¥´óÈ«
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"&g ......