<script type="text/javascript"> google_ad_client = "pub-5033576919944123"; google_ad_width = 728; google_ad_height = 90; google_ad_format = "728x90_as"; google_ad_type = "text_image"; //2007-10-24: csdn.blog google_ad_channel = "8548491739"; </script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>
请问 var a = {"aa": "aa", "bb":"bb"} 这种写法叫什么名
这个相当于
var a=new Object();
a.aa="aa";
a.bb="bb";
alert(0==="0");
这个会返回什么呢?这个值为假,因为三个===等号表示类型也要匹配
非IE浏览器下,如何用js读取远程URL的内容??
使用 var req=new XMLHttpRequest();
req.open("GET",url,false,null,null);
req.send("");
req.responseXML 就是一个 XmlDocument 对象.
请问在JS里面能否抛出一个自定义的错误,就像VBS里面的Err.Raise一样?
可以 throw new Error(errNum,errDescription);
下面是一个比较牛B的javascript
<html><head><script>
a=["+","-",">","<","[","]",".",",","#"],c=ip=mp=dp=d=b=e=r=0,v=255,m=[],pr=[],tg=[],inp=[],out='',lb="/r/n",q=document,f=false,t=true,px="BrainFuck=";
function nt(cd){
i=v;while(i--)m[i]=0;
mp=dp=pr.length=ip=tg.length=inp.length=0;out='';ts=[];
for(i=0;i<cd.length;i++){
op=cd.charAt(i);
for(j=0;j<9;j++)if(op==a[j])pr[pr.length]=op
}
for(i=0;i<pr.length;i++){
op=pr[i];
if(op=='[')ts.push(i);
if(op==']'){
if(!ts.length)alert('Err: missing [ or ]');
tg[tg[i]=ts.pop()]=i;
}}
if(ts.length>0)alert('Err: missing [ or ]');
qw=p('ei').value;
for(i=0;i<qw.length;i++)inp[inp.length]=qw.charAt(i)
}
function x(op){
switch(op){
case'+':m[mp]==v?m[mp]=0:m[mp]++;break;
case'-':m[mp]?m[mp]--:m[mp]=v;break;
case'>':mp==v?mp=0:mp++;break;
case'<':mp?mp--:mp=v;break;
case'[':if(!m[mp])ip=tg[ip];break;
case']':ip=tg[ip]-1;break;
case'.':out+=String.fromCharCode(m[mp]);break;
case',':if(p('im1').checked){
dt=window.prompt("Input a char, or #xxx for decimal input (## for a #)", "#0");
if(!dt){m[mp]=0;break}
if(dt.charAt(0)=='#')m[mp]=dt.charAt(1)=='#'?35:parseInt(dt.substr(1),9);
else m[mp]=dt.charCodeAt(0)
}else{m[mp]=(dp>=inp.length)?0:inp[dp].charCodeAt(0);dp++
}}}
function ud(){
ue=mp-7;
if(ue<0)ue+=v;
l1=l2=l3=l4='';
for(i=0;i<15;i++){
ug=ue+i;
if(ug>=v)ug-=v;
l1+=pn(m[ug],3)+' ';
l4+=pn(ug,3)+' '
}
for(i=0;i<7;i++)l2+=' ';
l3+=l2;l2+='^';
l3+='mp='+mp;
svd('mv',l1+lb+l2+lb+l3+lb+l4);
ue=ip-30;
l1=l2=l3='';
for(i=0;i<60;i++){
ug=ue+i;
(ug>=0)&&(ug<pr.length)?l1+=pr[ug]:l1+="_"
}
i=30;while(i--){l2+=' ';l3+=' '}l2+='^';l3+='ip='+ip;
svd('pv',l1+lb+l2+lb+l3);
if(e){svd('iv',"-input prompt mode-")}else{l1=inp.join('');l2='';
i=dp;while(i--)l2+=' ';l2+='^';svd('iv',l1+lb+l2)
}
l1=out;l2='';i=out.length;while(i--)l2+=' ';l2+='^';svd('ov',l1+lb+l2);
}
function bs(){tt(f);si();r=0}
function bt(){op=pr[ip];x(op);if(++ip>=pr.length){bs();svd('ov',out);return}window.setTimeout('bt();',0)}
function cbc(cbc,c2){p(cbc).value=c2}
function db(){if(b)d=1;else{tb('bd',t);tb('bs',t);cbc('brd','Stop running');b=1;d=0;rds()}}
function dbo(){if(ip>=pr.length){tb('bs',t);tb('brd',t)}}
function dbt(f){tb('es',!c);tb('ei',!c);tb('eq',!c);tb('br',!c);tb('im1',!c);tb('im2',!c);tb('bs',c);tb('brd',c);if(c){cbc('bd','Start Debugger');svd('pv','');svd('mv','');svd('iv','');svd('ov','');si()}else{cbc('bd','Quit Debugger');nt(p('es').value);ud()}c=!c}
function p(e){return document.getElementById(e)}
function pn(m,b){c=''+m;j=c.length;while(j++<b)c='0'+c;return c}
function rds(){stp();if((pr[ip]=='#')||d||(ip>=pr.length)){tb('bd',f);tb('bs',f);cbc('brd','Run Till #');b=0;dbo();return}window.setTimeout('rds()',0)}
function rn(f){if(r){bs();return}r=1;nt(f.s.value);tt(t);bt()}
function si(){p('im1').checked?tb('ei',t):tb('ei',f)}
function stp(){x(pr[ip]);ip++;ud();dbo()}
function svd(g,h){n=p(g);n.replaceChild(q.createTextNode(h),n.childNodes[0])}
function tb(tb,tb2){p(tb).disabled=tb2}
function tt(tt){tb('es',tt);tb('ei',tt);tb('eq',tt);tb('im1',tt);tb('im2',tt);tb('bd',tt); cbc('br',tt?'Stop':'Run')}
</script>
<style>pre.v{width:500px;padding:6px;border:1px solid;background-color:#ddd;margin:0px;}</style></head>
<body οnlοad="dc=document.cookie;py=dc.indexOf('; '+px);if(py==-1){py=dc.indexOf(px);if(py)return}else py+=2;pz=dc.indexOf(';',py);if(pz==-1)pz=dc.length;p('es').value=unescape(dc.substring(py+px.length,pz))">
BrainFuck<h4>編譯器 | 賽跑者 | 調試器</h4>
<form><table cellspacing=20 align=center>
<tr valign=top><td>
節目:<br>
<select οnchange="this.form.s.value=this.options[this.selectedIndex].value; this.selectedIndex=0;" id="eq">
<option>例子編程...<option value="++++++++++[>+++++++>
++++++++++>+++<<<-]>
++.>+.+++++++..+++.>
++.<<+++++++++++++++
.>.+++.------.------
--.>+.">賽跑世界!<option value="++++++>,<[>-----<-]>
--.">輸入對蓋帽</select><br>
<textarea id=es name=s></textarea>
<p>輸入:<br>
<input type=radio id=im1 name=v value=1 οnclick="si()">提示對於輸入:<br>
<input type=radio id=im2 name=v value=2 οnclick="si()" checked>前供應輸入:<br>
<textarea id=ei name=input></textarea><td>
<input type=button value="Run" οnclick="rn(this.form)" id=br>
<input type=button value="之外取Cookie" οnclick="document.cookie=px+escape(p('es').value)+'; expires=Thu, 01-Jan-05 00:00:01 GMT'">
<input type=button value="發動調試器" οnclick="dbt()" id=bd>
<input type=button value="單步" οnclick="stp()" disabled id=bs>
<input type=button value="跑直到#" οnclick="db()" disabled id=brd>
<br><br>
來源觀察者:
<pre class=v id=pv> </pre><br>
記憶觀察者:
<pre class=v id=mv> </pre><br>
輸入觀察者:
<pre class=v id=iv> </pre><br>
產品觀察者:
<pre class=v id=ov> </pre><br>
<h1>被得到的 比賽第五名</h1>
<script type="text/javascript"> google_ad_client = "pub-5033576919944123"; google_ad_width = 728; google_ad_height = 90; google_ad_format = "728x90_as"; google_ad_type = "text_image"; //2007-10-24: csdn.blog google_ad_channel = "8548491739"; </script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>