??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲免费综合,91在线中文字幕,国产一区二区久久http://www.aygfsteel.com/majianan/category/16293.html<br> <div align=center > <img width=200 height=50 src="http://www.aygfsteel.com/images/blogjava_net/majianan/14891/r_5858488902000cu2.gif" name="welcome"> </div> <br> <script language="JavaScript"> <!-- Begin text = "人本是hQ不必刻意去做hQ世本是世,无须_ֿ(j)d世;自然的才是快乐的?; color1 = "blue"; color2 = "red"; fontsize = "2"; speed = 100; i = 0; if (navigator.appName == "Netscape") { document.write("<layer id=a visibility=show></layer><br><br><br>"); } else { document.write("<div id=a></div>"); } function changeCharColor() { if (navigator.appName == "Netscape") { document.a.document.write("<center><font face=arial size =" + fontsize + "><font color=" + color1 + ">"); for (var j = 0; j < text.length; j++) { if(j == i) { document.a.document.write("<font face=arial color=" + color2 + ">" + Text.charAt(i) + "</font>"); } else { document.a.document.write(text.charAt(j)); } } document.a.document.write('</font></font></center>'); document.a.document.close(); } if (navigator.appName == "Microsoft Internet Explorer") { str = "<center><font face=arial size=" + fontsize + "><font color=" + color1 + ">"; for (var j = 0; j < text.length; j++) { if( j == i) { str += "<font face=arial color=" + color2 + ">" + text.charAt(i) + "</font>"; } else { str += text.charAt(j); } } str += "</font></font></center>"; a.innerHTML = str; } (i == text.length) ? i=0 : i++; } setInterval("changeCharColor()", speed); // End --> </script> zh-cnFri, 20 Apr 2007 02:51:26 GMTFri, 20 Apr 2007 02:51:26 GMT60用JavaScript(g)查大写键QCaps LockQ是否打开Q原创)(j)http://www.aygfsteel.com/majianan/archive/2007/02/01/97284.html马嘉?/dc:creator>马嘉?/author>Thu, 01 Feb 2007 07:21:00 GMThttp://www.aygfsteel.com/majianan/archive/2007/02/01/97284.htmlhttp://www.aygfsteel.com/majianan/comments/97284.htmlhttp://www.aygfsteel.com/majianan/archive/2007/02/01/97284.html#Feedback0http://www.aygfsteel.com/majianan/comments/commentRss/97284.htmlhttp://www.aygfsteel.com/majianan/services/trackbacks/97284.html  (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) 用JavaScript(g)查大写键QCaps LockQ是否打开Q原创)(j)

 (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) 马嘉?/font> (tng) (tng) (tng) 2007q???br />

新年W一!希望新的一q大家和我一样天天开?j),能多学点东西Q多多赚钱^-^


在用户遇到需要输入密码的面时候,密码中是否有大写字母Q大写键QCaps LockQ是否打开Q如果能l用户以提示Q岂不是更好Q?br />
下面的示例代码给Z(jin)Ҏ(gu)Q必要的说明代码当中都有注释?br />问中知识点:(x)event.keyCode (tng) ?event.shiftKey
如果有不对,不明白地Ҏ(gu)者有更好的徏议,请告诉我Q谢谢^+^



HTML面代码

<! DOCTYPE (tng)HTML (tng)PUBLIC (tng)"-//W3C//DTD (tng)HTML (tng)4.0 (tng)Transitional//EN" >
< HTML >
< HEAD >
< TITLE >  (tng)Detect (tng)Caps (tng)Lock </ TITLE >
< script >
function  (tng)detectCapsLock(e){
 (tng) (tng) (tng) (tng)valueCapsLock (tng)
=  (tng)e.keyCode ? e.keyCode:e.which; // Caps (tng)Lock 是否打开

 (tng) (tng) (tng) (tng)valueShift (tng) =  (tng)e.shiftKey ? e.shiftKey:((valueCapsLock (tng) ==  (tng) 16 ) ? true : false ); // shift键是否按?br />
 (tng) (tng) (tng) (tng) if (((valueCapsLock (tng) >=  (tng) 65  (tng) &&  (tng)valueCapsLock (tng) <=  (tng) 90 ) (tng) &&  (tng) ! valueShift) // Caps (tng)Lock (tng)打开Qƈ且?tng)shift键没有按?/span>
 (tng) (tng) (tng) (tng) || ((valueCapsLock (tng) >=  (tng) 97  (tng) &&  (tng)valueCapsLock (tng) <=  (tng) 122 ) (tng) &&  (tng)valueShift)) // Caps (tng)Lock (tng)打开Qƈ且按住?tng)shift?/span>
 (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng)document.getElementById('capStatus').style.visibility (tng) =  (tng)'visible';
 (tng) (tng) (tng) (tng)
else

 (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng)document.getElementById('capStatus').style.visibility (tng)
=  (tng)'hidden';

 (tng) (tng)
/*

 (tng) (tng)javascript中keyCode代码对应?br /> (tng) (tng)event.keyCode=32 (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng)I格
 (tng) (tng)event.keyCode=13 (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng)回R
 (tng) (tng)event.keyCode=27 (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng)Esc
 (tng) (tng)event.keyCode=16) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng)Shift
 (tng) (tng)event.keyCode=17) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng)Ctrl
 (tng) (tng)event.keyCode=18) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng)Alt
 (tng) (tng)
*/

}
</ script >
</ HEAD >

< BODY >
< input (tng) type ="password"  (tng)name ="pwd"  (tng)onkeypress ="detectCapsLock(event)"  (tng) />
< div (tng) id ="capStatus"  (tng)style ="visibility:hidden" >< font (tng) color =red > Caps (tng)Lock (tng)is (tng)on. < font ></ div >
</ BODY >
</ HTML >





]]>
单的密码验证控ghttp://www.aygfsteel.com/majianan/archive/2006/12/07/86036.html马嘉?/dc:creator>马嘉?/author>Thu, 07 Dec 2006 03:25:00 GMThttp://www.aygfsteel.com/majianan/archive/2006/12/07/86036.htmlhttp://www.aygfsteel.com/majianan/comments/86036.htmlhttp://www.aygfsteel.com/majianan/archive/2006/12/07/86036.html#Feedback0http://www.aygfsteel.com/majianan/comments/commentRss/86036.htmlhttp://www.aygfsteel.com/majianan/services/trackbacks/86036.html  (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng)单的密码验证控g

 (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) 马嘉?/font> (tng) (tng) (tng)2006-12-07

最q一直在?不过忙得很充?学到?jin)很多东?准备一点一Ҏ(gu)?
q个密码验证很简?作ؓ(f)一个独立的控g,可以拿来直接用^+^


pwd.html


<! DOCTYPE (tng)HTML (tng)PUBLIC (tng)"-//W3C//DTD (tng)HTML (tng)4.0 (tng)Transitional//EN" >
< HTML >
< HEAD >
< TITLE > 密码修改 </ TITLE >
</ HEAD >
< script (tng) language ="javascript" >
// 密码修改
function  (tng)CheckUpdatePwd(text){
 (tng) (tng) (tng) (tng)
if ( ! confirm( " 认修改密码? "
))
 (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng)
return
 (tng);
 (tng) (tng) (tng) (tng)
var  (tng)newpwd (tng) =  (tng)window.showModalDialog('confirmpwd.htm', (tng) "" , (tng) " dialogWidth: (tng)280px; (tng)dialogHeight: (tng)150px; (tng)help: (tng)no; (tng)status: (tng)no "
);
 (tng) (tng) (tng) (tng)
if (newpwd == ""  (tng) ||  (tng)newpwd == null
) (tng){
 (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng)alert(
" 密码没有修改! "
);
 (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng)
return  (tng) true
;
 (tng) (tng) (tng) (tng)}
else
 (tng){;
 (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng)text.value (tng)
=
 (tng)newpwd;
 (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng)
return
;
 (tng) (tng) (tng) (tng)}
}
</ script >


< BODY >
< table (tng) id ="pwdTable"  (tng)width ="100%"  (tng)height ="100%"  (tng)border ="0"  (tng)cellspacing ="2"  (tng)cellpadding ="0" >  (tng)
< tr >

< td (tng) align ="right"  (tng)width ="75" > 客户密码Q?/span> </ td >  (tng)
< td >  (tng) < input (tng) type ="password"  (tng)datafld ="cust_pwd"  (tng)name ="cust_pwd"  (tng)style ="border:1px (tng)solid (tng)#CCCCCC; (tng)font-size:12px; (tng)background-color:#FFFFFF; (tng)width:135px"  (tng)onFocus ="CheckUpdatePwd(this)"  (tng)maxlength ="6" >
 (tng)
< font (tng) color ="#FF0000" > Q?/span> </ font >  (tng) </ td >

</ tr >
</ table >
</ BODY >
</ HTML >


confirmpwd.htm

< html >
< head >
< meta (tng) http-equiv ="Content-Type"  (tng)content ="text/html; (tng)charset=gb2312" >
< link (tng) href ="../../css/all_import.css"  (tng)rel =stylesheet >
< title > 密码修改 </ title >
< script (tng) language ="JavaScript"  (tng)type ="text/JavaScript" >
function  (tng)modifyPwd() (tng){
 (tng) (tng) (tng) (tng)
var  (tng)newPwd (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) =  (tng)document.all( " newPwd "
).value;
 (tng) (tng) (tng) (tng)
var  (tng)confirmPwd (tng) (tng) (tng) (tng) =  (tng)document.all( " confirmPwd "
).value;

 (tng) (tng) (tng) (tng)
if (newPwd.length (tng) ==  (tng) 0
) (tng){
 (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng)alert(
" 误入新密码! "
);
 (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng)
return
;
 (tng) (tng) (tng) (tng)} (tng)
else  (tng) if (newPwd.length (tng) !=
 (tng)confirmPwd.length){
 (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng)alert(
" 密码长度不一?请重新输? "
);
 (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng)resetConfirmPwd();
 (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng)
return
;
 (tng) (tng) (tng) (tng)} (tng)
else  (tng) if (newPwd (tng) !=
 (tng)confirmPwd) (tng){
 (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng)alert(
" 两次输入的密码不一?请重新输? "
);
 (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng)resetConfirmPwd();
 (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng)
return
;
 (tng) (tng) (tng) (tng)} (tng)
else
{
 (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng)alert(
" 密码修改成功! "
)
 (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng)window.returnValue (tng)
=
 (tng)newPwd;
 (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng)window.close();
 (tng) (tng) (tng) (tng)}
}

function
 (tng)resetConfirmPwd(){
 (tng) (tng) (tng) (tng)document.all.newPwd.value (tng)
=  (tng) ""
;
 (tng) (tng) (tng) (tng)document.all.confirmPwd.value (tng)
=  (tng) ""
;
}
</ script >

</ head >
< body (tng) bgcolor ="#f0f0f0" >  (tng)
< table (tng) width ="100%"  (tng)border ="0"  (tng)cellpadding ="0"  (tng)cellspacing ="0" >
 (tng)
 (tng) (tng)
< tr >
 (tng)
 (tng) (tng) (tng) (tng)
< td (tng) colspan ="3"  (tng)align ="right" > &nbsp; </ td >
 (tng)
 (tng) (tng)
</ tr >
 (tng)
 (tng) (tng)
< tr >
 (tng)
 (tng) (tng) (tng) (tng) (tng) (tng)
< td > &nbsp; </ td >
 (tng)
 (tng) (tng) (tng) (tng)
< td (tng) width ="100" align ="right"  (tng)style ="border:1px (tng)solid (tng)#CCCCCC; (tng)font-size:12px;" >  (tng)误入新密码Q?/span> </ td >
 (tng)
 (tng) (tng) (tng) (tng)
< td (tng) width ="120" >  (tng) < input (tng) name ="newPwd"  (tng)type ="password"  (tng)id ="newPwd"  (tng)maxlength ="6"  (tng)style ="width:135px" ></ td >
 (tng)
 (tng) (tng) (tng) (tng)
< td > &nbsp; </ td >
 (tng)
 (tng) (tng)
</ tr >
 (tng)
 (tng) (tng)
< tr >
 (tng)
 (tng) (tng) (tng) (tng) (tng) (tng)
< td > &nbsp; </ td >
 (tng)
 (tng) (tng) (tng) (tng)
< td (tng) width ="100"  (tng)align ="right"  (tng)style ="border:1px (tng)solid (tng)#CCCCCC; (tng)font-size:12px;" >  (tng)L(fng)认新密码Q?/span> </ td >
 (tng)
 (tng) (tng) (tng) (tng)
< td (tng) width ="120" >  (tng) < input (tng) name ="confirmPwd"  (tng)type ="password"  (tng)id ="confirmPwd"  (tng)maxlength ="6"  (tng)style ="width:135px" ></ td >
 (tng)
 (tng) (tng) (tng) (tng)
< td > &nbsp; </ td >
 (tng)
 (tng) (tng)
</ tr >
 (tng)
</ table >
 (tng)
< table (tng) width ="100%"  (tng)height ="60"  (tng)border ="0"  (tng)cellpadding ="0"  (tng)cellspacing ="0" >
 (tng)
 (tng) (tng)
< tr (tng) align ="center" >
 (tng)
 (tng) (tng) (tng) (tng)
< td > &nbsp; </ td >
 (tng)
 (tng) (tng) (tng) (tng)
< td (tng) width ="65" >  (tng) < input (tng) name ="ok"  (tng)type ="button"  (tng)class ="btn_70"  (tng)id ="ok"  (tng)value ="?tng)?  (tng)onClick ="modifyPwd()" ></ td >
 (tng)
 (tng) (tng) (tng) (tng)
< td (tng) width ="15" > &nbsp; </ td >
 (tng)
 (tng) (tng) (tng) (tng)
< td (tng) width ="65" >  (tng) < input (tng) name ="reset"  (tng)type ="button"  (tng)class ="btn_70"  (tng)id ="reset"  (tng)value ="重?tng)?  (tng)onClick ="resetConfirmPwd()" ></ td >
 (tng)
 (tng) (tng) (tng) (tng)
< td (tng) width ="15" > &nbsp; </ td >
 (tng)
 (tng) (tng) (tng) (tng)
< td (tng) width ="65" >  (tng) < input (tng) name ="close"  (tng)type ="button"  (tng)class ="btn_70"  (tng)id ="close"  (tng)value ="ꐠ闭"  (tng)onClick ="window.close()" >  (tng) </ td >
 (tng)
 (tng) (tng) (tng) (tng)
< td > &nbsp; </ td >
 (tng)
 (tng) (tng)
</ tr >
 (tng)
</ table >
 (tng)
</ body >

</ html >


]]>
如何让你的程序运行的更快 Q?Q?-- JavaScript中的数组之字W串下标的运?http://www.aygfsteel.com/majianan/archive/2006/11/09/80184.html马嘉?/dc:creator>马嘉?/author>Thu, 09 Nov 2006 08:44:00 GMThttp://www.aygfsteel.com/majianan/archive/2006/11/09/80184.htmlhttp://www.aygfsteel.com/majianan/comments/80184.htmlhttp://www.aygfsteel.com/majianan/archive/2006/11/09/80184.html#Feedback0http://www.aygfsteel.com/majianan/comments/commentRss/80184.htmlhttp://www.aygfsteel.com/majianan/services/trackbacks/80184.html阅读全文

]]>
JavaScript中的BooleanQ你?jin)解多少Q?/title><link>http://www.aygfsteel.com/majianan/archive/2006/10/30/78177.html</link><dc:creator>马嘉?/dc:creator><author>马嘉?/author><pubDate>Mon, 30 Oct 2006 15:41:00 GMT</pubDate><guid>http://www.aygfsteel.com/majianan/archive/2006/10/30/78177.html</guid><wfw:comment>http://www.aygfsteel.com/majianan/comments/78177.html</wfw:comment><comments>http://www.aygfsteel.com/majianan/archive/2006/10/30/78177.html#Feedback</comments><slash:comments>9</slash:comments><wfw:commentRss>http://www.aygfsteel.com/majianan/comments/commentRss/78177.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/majianan/services/trackbacks/78177.html</trackback:ping><description><![CDATA[ <font face="Verdana" size="2"> <font color="#000080" size="4"> (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) JavaScript中的BooleanQ你?jin)解多少Q?/font> <br /> (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng)<a href="/majianan"><font color="#0000ff">马嘉?/font></a> (tng) (tng) (tng) (tng) (tng) (tng)2006-10-30<br /><br /><br />今天看了(jin)一?a href="ttp://www.aygfsteel.com/flyingis">Flyingis</a>写的?a href="/flyingis/archive/2006/06/13/52484.html?CommentID=78102#Post">ECMAScript 基础</a>》一文。在看到</font> <font face="Verdana" size="2">Booleanc这一块内容的时候,随手写了(jin)几行代码Q问题出C(jin)^+^<br />注:(x)此文讨论的是JavaScript1.5<br /><br /><br />q是先来看一D非常简单的代码<br /><br /></font> <div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; font-size: 13px; width: 98%; background-color: rgb(238, 238, 238);"> <font size="2"> <font face="Verdana"> <span style="color: rgb(0, 128, 0);">//</span> <span style="color: rgb(0, 128, 0);">codeQ?</span> </font> </font> <span style="color: rgb(0, 128, 0);"> <br /> </span> <font size="2"> <font face="Verdana"> <span style="color: rgb(0, 0, 255);">var</span> <span style="color: rgb(0, 0, 0);"> (tng)x (tng)</span> <span style="color: rgb(0, 0, 0);">=</span> <span style="color: rgb(0, 0, 0);"> (tng)</span> <span style="color: rgb(0, 0, 255);">false</span> </font> </font> <font size="2"> <font face="Verdana"> <span style="color: rgb(0, 0, 0);">; (tng) (tng) (tng)<br /></span> <span style="color: rgb(0, 0, 255);">var</span> <span style="color: rgb(0, 0, 0);"> (tng)y (tng)</span> <span style="color: rgb(0, 0, 0);">=</span> <span style="color: rgb(0, 0, 0);"> (tng)</span> <span style="color: rgb(0, 0, 255);">true</span> </font> </font> <font size="2"> <font face="Verdana"> <span style="color: rgb(0, 0, 0);">;<br /><br /></span> <span style="color: rgb(0, 128, 0);">//</span> <span style="color: rgb(0, 128, 0);">codeQ?</span> </font> </font> <span style="color: rgb(0, 128, 0);"> <br /> </span> <font size="2"> <font face="Verdana"> <span style="color: rgb(0, 0, 255);">var</span> <span style="color: rgb(0, 0, 0);"> (tng)xObject (tng)</span> <span style="color: rgb(0, 0, 0);">=</span> <span style="color: rgb(0, 0, 0);"> (tng)</span> <span style="color: rgb(0, 0, 255);">new</span> <span style="color: rgb(0, 0, 0);"> (tng)Boolean(</span> <span style="color: rgb(0, 0, 255);">false</span> </font> </font> <font size="2"> <font face="Verdana"> <span style="color: rgb(0, 0, 0);">);<br /></span> <span style="color: rgb(0, 0, 255);">var</span> <span style="color: rgb(0, 0, 0);"> (tng)yObject (tng)</span> <span style="color: rgb(0, 0, 0);">=</span> <span style="color: rgb(0, 0, 0);"> (tng)</span> <span style="color: rgb(0, 0, 255);">new</span> <span style="color: rgb(0, 0, 0);"> (tng)Boolean(</span> <span style="color: rgb(0, 0, 255);">true</span> </font> </font> <font size="2"> <font face="Verdana"> <span style="color: rgb(0, 0, 0);">);<br /><br /></span> <span style="color: rgb(0, 128, 0);">//</span> <span style="color: rgb(0, 128, 0);">codeQ?</span> </font> </font> <span style="color: rgb(0, 128, 0);"> <br /> </span> <font size="2"> <font face="Verdana"> <span style="color: rgb(0, 0, 255);">var</span> <span style="color: rgb(0, 0, 0);"> (tng)resX (tng)</span> <span style="color: rgb(0, 0, 0);">=</span> <span style="color: rgb(0, 0, 0);"> (tng)</span> <span style="color: rgb(0, 0, 255);">new</span> </font> </font> <font size="2"> <font face="Verdana"> <span style="color: rgb(0, 0, 0);"> (tng)Boolean(x);<br /></span> <span style="color: rgb(0, 0, 255);">var</span> <span style="color: rgb(0, 0, 0);"> (tng)resY (tng)</span> <span style="color: rgb(0, 0, 0);">=</span> <span style="color: rgb(0, 0, 0);"> (tng)</span> <span style="color: rgb(0, 0, 255);">new</span> </font> </font> <font size="2"> <font face="Verdana"> <span style="color: rgb(0, 0, 0);"> (tng)Boolean(y);<br /><br /></span> <span style="color: rgb(0, 128, 0);">//</span> <span style="color: rgb(0, 128, 0);">codeQ?</span> </font> </font> <span style="color: rgb(0, 128, 0);"> <br /> </span> <font size="2"> <font face="Verdana"> <span style="color: rgb(0, 0, 255);">var</span> <span style="color: rgb(0, 0, 0);"> (tng)resXObject (tng)</span> <span style="color: rgb(0, 0, 0);">=</span> <span style="color: rgb(0, 0, 0);"> (tng)</span> <span style="color: rgb(0, 0, 255);">new</span> </font> </font> <font size="2"> <font face="Verdana"> <span style="color: rgb(0, 0, 0);"> (tng)Boolean(xObject);<br /></span> <span style="color: rgb(0, 0, 255);">var</span> <span style="color: rgb(0, 0, 0);"> (tng)resYObject (tng)</span> <span style="color: rgb(0, 0, 0);">=</span> <span style="color: rgb(0, 0, 0);"> (tng)</span> <span style="color: rgb(0, 0, 255);">new</span> </font> </font> <font size="2"> <font face="Verdana"> <span style="color: rgb(0, 0, 0);"> (tng)Boolean(yObject);<br /><br /></span> <span style="color: rgb(0, 128, 0);">//</span> <span style="color: rgb(0, 128, 0);">codeQ?</span> </font> </font> <span style="color: rgb(0, 128, 0);"> <br /> </span> <font size="2"> <font face="Verdana"> <span style="color: rgb(0, 0, 0);">alert(</span> <span style="color: rgb(0, 0, 0);">"</span> <span style="color: rgb(0, 0, 0);">resX (tng)= (tng)</span> <span style="color: rgb(0, 0, 0);">"</span> <span style="color: rgb(0, 0, 0);"> (tng)</span> <span style="color: rgb(0, 0, 0);">+</span> <span style="color: rgb(0, 0, 0);"> (tng)resX (tng)</span> <span style="color: rgb(0, 0, 0);">+</span> <span style="color: rgb(0, 0, 0);"> (tng)</span> <span style="color: rgb(0, 0, 0);">"</span> <span style="color: rgb(0, 0, 0);"> (tng)and (tng)resY (tng)= (tng)</span> <span style="color: rgb(0, 0, 0);">"</span> <span style="color: rgb(0, 0, 0);"> (tng)</span> <span style="color: rgb(0, 0, 0);">+</span> </font> </font> <font size="2"> <font face="Verdana"> <span style="color: rgb(0, 0, 0);"> (tng)resY);<br />alert(</span> <span style="color: rgb(0, 0, 0);">"</span> <span style="color: rgb(0, 0, 0);">resXObject (tng)= (tng)</span> <span style="color: rgb(0, 0, 0);">"</span> <span style="color: rgb(0, 0, 0);"> (tng)</span> <span style="color: rgb(0, 0, 0);">+</span> <span style="color: rgb(0, 0, 0);"> (tng)resXObject (tng)</span> <span style="color: rgb(0, 0, 0);">+</span> <span style="color: rgb(0, 0, 0);"> (tng)</span> <span style="color: rgb(0, 0, 0);">"</span> <span style="color: rgb(0, 0, 0);"> (tng)and (tng)resYObject (tng)= (tng)</span> <span style="color: rgb(0, 0, 0);">"</span> <span style="color: rgb(0, 0, 0);"> (tng)</span> <span style="color: rgb(0, 0, 0);">+</span> <span style="color: rgb(0, 0, 0);"> (tng)resYObject);</span> </font> </font> </div> <br /> <font face="Verdana" size="2">你明白codeQ?~4 之间的区别么Q(你一定对codeQ?最为熟(zhn),q是我们最常用的)(j)<br />你知道codeQ? 的输出结果么Q(可以先想惻I在运行代码看l果Q如果不明白Q可以l看下去Q?br /><br /><br />如果你已l开始头晕了(jin)Q那暂时不L?jin),看我下面的解释?br />如果你都知道?jin)(哇,高手啊,呵呵^+^Q,那我q有个问题需要你的解{,在此先谢q了(jin)?br /><br /><br />正文Q?br /><font color="#0000ff">JavaScript中的Booleancd</font><br /><br /><font color="#000080">1. (tng) (tng) (tng)我们所熟?zhn)?br /></font><br />var x = false;<br />var y = true;<br /><br />q是我们大家都熟(zhn)的Q此时我们用的是原始的Boolean|<font color="#0000ff">the primitive Boolean values</font> Qtrue和false<br /><br /><font color="#000080">2. (tng) (tng) (tng)我们很少用到?/font><br /><br />var xObject = new Boolean(false);<br />var yObject = new Boolean(true);<br /><br />此时我们声明?jin)一?font color="#0000ff">Boolean对象</font>QBoolean对象是对Boolean值的一个封装?br />Boolean对象Q一个gؓ(f)true或false的Boolean对象?br /><br />原始的Boolean值和Boolean对象是有区别的,不要怺hQ引?font color="#0000ff">Core JavaScript 1.5 Reference</font>中的一句话Q?font color="#a52a2a">Do not confuse the primitive Boolean values true and false with the true and false values of the Boolean object.<br /></font><br /><br /><font color="#000080">3. (tng) (tng) (tng)区别<br /></font><br />区别Q?Q:(x) (tng) (tng) (tng)声明形式<br /><br />区别Q?Q:(x) (tng) (tng) (tng)在条件语句(condition statementQ中<br /><br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; font-size: 13px; width: 98%; background-color: rgb(238, 238, 238);"><span style="color: rgb(0, 0, 255);">var</span><span style="color: rgb(0, 0, 0);"> (tng)x (tng)</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> (tng)</span><span style="color: rgb(0, 0, 255);">false</span><span style="color: rgb(0, 0, 0);">;<br /></span><span style="color: rgb(0, 0, 255);">var</span><span style="color: rgb(0, 0, 0);"> (tng)xObject (tng)</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> (tng)</span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> (tng)Boolean(</span><span style="color: rgb(0, 0, 255);">false</span><span style="color: rgb(0, 0, 0);">);<br /><br /></span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">(x)<br /> (tng) (tng) (tng) (tng)alert(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">x (tng)= (tng)true</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">);<br /></span><span style="color: rgb(0, 0, 255);">else</span><span style="color: rgb(0, 0, 0);"><br /> (tng) (tng) (tng) (tng)alert(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">x (tng)= (tng)false</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">);<br /><br /></span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">(xObject)<br /> (tng) (tng) (tng) (tng)alert(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">xObject (tng)= (tng)</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"> (tng)</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> (tng)xObject (tng)</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> (tng)</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">, (tng)but (tng)in (tng)the (tng)condition (tng)statement, (tng)the (tng)xObject (tng)value (tng)is (tng)evaluated (tng)to (tng)true</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">);<br /></span><span style="color: rgb(0, 0, 255);">else</span><span style="color: rgb(0, 0, 0);"><br /> (tng) (tng) (tng) (tng)alert(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">xObject (tng)= (tng)false</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">);</span></div><br /><br />输出l果Q?br /><br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; font-size: 13px; width: 98%; background-color: rgb(238, 238, 238);"><span style="color: rgb(0, 0, 0);">x (tng)</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> (tng)</span><span style="color: rgb(0, 0, 255);">false</span><span style="color: rgb(0, 0, 0);"><br />xObject (tng)</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> (tng)</span><span style="color: rgb(0, 0, 255);">false, (tng)<font color="#000000"> (tng)but (tng)in (tng)the (tng)condition (tng)statement, (tng)the (tng)xObject (tng)value (tng)is (tng)evaluated (tng)to (tng)true</font></span></div><br /><br />当一个gؓ(f)false的Boolean对象攑ֈ条g语句当中的时候,Boolean对象的g(x)被当作true来计,但是它本w的值ƈ没有改变Q依然是false。很有趣Q我只知道现象,具体原因不清楚,不知道发明者出于什么地考虑。但是在JavaScript1.2或者更早的版本中却有所不同Q在条g语句Qcondition statementQ中QBoolean对象的计返回的是其对应的原始Boolean的倹{?br /><br /><br />区别Q?Q:(x)初始化Boolean对象<br /><br />声明一个Boolean对象Q如果我们用一个gؓ(f)false的Boolean对象对其q行初始化,则新的Boolean对象的gؓ(f)true<br /><br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; font-size: 13px; width: 98%; background-color: rgb(238, 238, 238);"><span style="color: rgb(0, 0, 255);">var</span><span style="color: rgb(0, 0, 0);"> (tng)xObject (tng)</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> (tng)</span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> (tng)Boolean(</span><span style="color: rgb(0, 0, 255);">false</span><span style="color: rgb(0, 0, 0);">);<br /></span><span style="color: rgb(0, 0, 255);">var</span><span style="color: rgb(0, 0, 0);"> (tng)resXObject (tng)</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> (tng)</span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> (tng)Boolean(xObject);<br />alert(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">The (tng)resXObject (tng)value (tng)is (tng)</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"> (tng)</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> (tng)resXObject);</span></div><br />原始的Boolean值和Boolean对象区别如此之大Q所以切C者区别,不要h使用?br /><br />对于codeQ? 的输出结果,你现在明白是什么原因了(jin)吧?br /><br /><br /><br />上面的东东我也是今天遇到?jin)问题,查?jin)一些资料才知道Q学无止境啊。可是我的问题(sh)然没有解冟?br />我的问题是关于Boolean对象的初始化。代码如下,<br /><br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; font-size: 13px; width: 98%; background-color: rgb(238, 238, 238);"><span style="color: rgb(0, 0, 255);">var</span><span style="color: rgb(0, 0, 0);"> (tng)ob1 (tng)</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> (tng)</span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> (tng)Boolean(</span><span style="color: rgb(0, 0, 255);">false</span><span style="color: rgb(0, 0, 0);">);<br /></span><span style="color: rgb(0, 0, 255);">var</span><span style="color: rgb(0, 0, 0);"> (tng)ob2 (tng)</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> (tng)(ob1</span><span style="color: rgb(0, 0, 0);">&&</span><span style="color: rgb(0, 0, 255);">true</span><span style="color: rgb(0, 0, 0);">);<br /></span><span style="color: rgb(0, 0, 255);">var</span><span style="color: rgb(0, 0, 0);"> (tng)ob3 (tng)</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> (tng)(</span><span style="color: rgb(0, 0, 255);">true</span><span style="color: rgb(0, 0, 0);">&&</span><span style="color: rgb(0, 0, 0);">ob1);<br /></span><span style="color: rgb(0, 0, 255);">var</span><span style="color: rgb(0, 0, 0);"> (tng)ob4 (tng)</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> (tng)Boolean(ob1</span><span style="color: rgb(0, 0, 0);">&&</span><span style="color: rgb(0, 0, 255);">true</span><span style="color: rgb(0, 0, 0);">);<br /></span><span style="color: rgb(0, 0, 255);">var</span><span style="color: rgb(0, 0, 0);"> (tng)ob5 (tng)</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> (tng)Boolean(</span><span style="color: rgb(0, 0, 255);">true</span><span style="color: rgb(0, 0, 0);">&&</span><span style="color: rgb(0, 0, 0);">ob1);<br />alert(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">ob2 (tng)= (tng)</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"> (tng)</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> (tng)ob2 (tng)</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> (tng)</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"> (tng)ob3 (tng)= (tng)</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"> (tng)</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> (tng)ob3 (tng)</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> (tng)</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"> (tng)ob4 (tng)= (tng)</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"> (tng)</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> (tng)ob4 (tng)</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> (tng)</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"> (tng)ob5 (tng)= (tng)</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"> (tng)</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> (tng)ob5);</span></div><br />l果Q?br /><br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; font-size: 13px; width: 98%; background-color: rgb(238, 238, 238);"><span style="color: rgb(0, 0, 0);">ob2 (tng)</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> (tng)</span><span style="color: rgb(0, 0, 255);">true</span><span style="color: rgb(0, 0, 0);"> (tng)ob3 (tng)</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> (tng)</span><span style="color: rgb(0, 0, 255);">false</span><span style="color: rgb(0, 0, 0);"> (tng)ob4 (tng)</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> (tng)</span><span style="color: rgb(0, 0, 255);">true</span><span style="color: rgb(0, 0, 0);"> (tng)ob5 (tng)</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> (tng)</span><span style="color: rgb(0, 0, 255);">true</span></div><br /></font> <div align="center"> <font face="Verdana" size="2"> <img src="http://www.aygfsteel.com/images/blogjava_net/majianan/js.JPG" alt="js.JPG" border="0" height="531" width="610" /> </font> <br /> </div> <font face="Verdana" size="2"> <br /> <br />我对ob2 ?ob3的结果不太理解,Z么我只是更改?jin)ob1和true的顺序,l果d全不同了(jin)。ƈ且可以发玎ͼl果均等于操作符?amp;&”后面的倹{?br /><br />希望大家能告诉我Q?br /><br /><br /></font> <font face="Verdana" size="2"> <font color="#ff0000">问题已经解决Q?/font> <br /> <br /> <font color="#0000ff">||是这栯的</font>Q从W一个开始,遇到有意义的q回Q否则返回最后一个表辑ּQ注意不一定是Boolean|(j)Q? <br /><br /><font color="#0000ff">&&是这栯的</font>Q从W一个开始,遇到无意义的q回Q否则返回最后一个表辑ּQ注意同上)(j)Q? <br /><font color="#0000ff"><br />!是这栯的Q?/font>对表辑ּ的值取非(注意不是对表辑ּQ? <br /><br />什么是无意义呢Q如下六?0,null,undefined,"",false,NaN。除此,视ؓ(f)有意义? <br /><br />new Boolean(),new Boolean(false)是同一个东西,׃它是一个对象,故是有意义的Q但其gؓ(f)falseQ所以,可以看ؓ(f)“有意义的false”,所以结果ؓ(f)最后一个表辑ּ的倹{? <br /><br />谢谢</font> <font face="Verdana" size="2">jeffjie </font> <br /> <font face="Verdana" size="2"> <br />l箋(hu)学习(fn)^+^ </font> <br /> <font face="Verdana" size="2"> <br /> <br /> <br /> </font> <img src ="http://www.aygfsteel.com/majianan/aggbug/78177.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/majianan/" target="_blank">马嘉?/a> 2006-10-30 23:41 <a href="http://www.aygfsteel.com/majianan/archive/2006/10/30/78177.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>JavaScript For BeginnersQ{载)(j)http://www.aygfsteel.com/majianan/archive/2006/10/25/77141.html马嘉?/dc:creator>马嘉?/author>Wed, 25 Oct 2006 06:26:00 GMThttp://www.aygfsteel.com/majianan/archive/2006/10/25/77141.htmlhttp://www.aygfsteel.com/majianan/comments/77141.htmlhttp://www.aygfsteel.com/majianan/archive/2006/10/25/77141.html#Feedback4http://www.aygfsteel.com/majianan/comments/commentRss/77141.htmlhttp://www.aygfsteel.com/majianan/services/trackbacks/77141.html阅读全文

]]>
վ֩ģ壺 ϲ| ƽ| | Ĭ| | | | ˮ| ʲ| ʯ| | Ѱ| | | | | | ɽ| ˮ| | ƽ| | | | | ȫ| | | ˫| | | | ޳| ɽ| ɽ| ƺ| ʱ| | | | Ϫ|