javascript ÀúÊ·Õ»
var Stack=function(limt_length){
this.stack=new Array();
this.limt=(limt_length)?limt_length:8;
}
Stack.prototype.push=function(o){
if(this.exist(o)){
this.remove(o);
this.stack.unshift(o);
}else{
this.stack.unshift(o);
}
while(this.stack.length>this.limt){
this.stack=this.stack.reverse();
this.stack.shift();
this.stack=this.stack.reverse();
}
};
Stack.prototype.pop=function(){
return this.stack.shift();
};
Stack.prototype.exist=function(o){
return (this.getIndex(o)>-1);
};
Stack.prototype.getIndex=function(o){
var ret=-1;
for(var i=0,len=this.stack.length;i<len;i++){
if(this.stack[i]==o){return i;}
}
return ret;
};
Stack.prototype.remove=function(o){
var _i=this.getIndex(o);
if(_i>-1){
var fArray=this.stack.slice(0,_i);
var bArray=this.stack.slice(_i+1,this.stack.length);
this.stack=fArray.concat(bArray);
}else{
throw new Eorr("Õ»Öв»°üº¬´Ë¶ÔÏó");
}
};
Stack.prototype.getCurret=function(){
return this.stack[0];
};
var s=new Stack();
var f=function(i){this.id=i;}
var tar=[];
for(var i=0;i<10;i++){
var _f=new f(i);
tar.push(_f);
s.push(_f);
}
var sss1=(function(){
var p="";
for(var i=0;i<s.stack.length;i++){
p=p+s.stack[i].id+","
}
return p;
})()
s.push(tar[1]);
var sss2=(function(){
var p="";
for(var i=0;i<s.stack.length;i++){
p=p+s.stack[i].id+","
}
return p;
})()
alert(s.getCurret().id+" "+s.pop().id)
alert(sss1)
alert(sss2)
Ïà¹ØÎĵµ£º
JavaScriptÓïÑÔºÍJavaÓïÑÔÊÇÏà¹ØµÄ£¬µ«ËüÃÇÖ®¼äµÄÁªÏµ²¢²»ÏñÏëÏóÖеÄÄÇÑù½ôÃÜ¡£
¡¡¡¡ ¶þÕßµÄÇø±ðÌåÏÖÔÚ£º
¡¡¡¡ Ê×ÏÈ£¬ËüÃÇÊÇÁ½¸ö¹«Ë¾¿ª·¢µÄ²»Í¬µÄÁ½¸ö²úÆ·£¬JavaÊÇSUN¹«Ë¾ÍƳöµÄÐÂÒ»´úÃæÏò¶ÔÏóµÄ³ÌÐòÉè¼ÆÓïÑÔ£¬ÌرðÊʺÏÓÚInternetÓ¦ÓóÌÐò¿ª·¢£»¶øJavaScrip ......
ʹÓà Cookies¡¡¡¡ÎÒÃÇÒѾ֪µÀ£¬ÔÚ document ¶ÔÏóÖÐÓÐÒ»¸ö cookie ÊôÐÔ¡£µ«ÊÇ Cookie ÓÖÊÇʲô£¿“ijЩ Web
Õ¾µãÔÚÄúµÄÓ²ÅÌÉÏÓúÜСµÄÎı¾Îļþ´æ´¢ÁËһЩÐÅÏ¢£¬ÕâЩÎļþ¾Í³ÆÎª Cookie¡£”—— MSIE °ïÖú¡£Ò»°ãÀ´Ëµ£¬Cookies ÊÇ CGI
»òÀàËÆ£¬±È HTML ¸ß¼¶µÄÎļþ¡¢³ÌÐòµÈ´´½¨µÄ£¬µ«ÊÇ JavaScript Ò²Ìá¹ ......
JavaScript·½·¨ºÍ¼¼ÇÉ´óÈ« »ù´¡ÖªÊ¶
1 ´´½¨½Å±¾¿é <script language=”JavaScript”> JavaScript code goes here </script>
2 Òþ²Ø½Å±¾´úÂë <script language=”JavaScript”><!-- document.write(“Hello”); --> </script>
ÔÚ²»Ö§³Ö ......
css»ñÈ¡Ò³ÃæÖÐÐÄλÖÃ
.fixed
{
FONT-SIZE: 30pt;
color : #1A6841;
left:expression(eval(document.body.clientWidth)/2-150);
top:expression(eval(document.body.clientHeight)/2-25);
width:300px;
height:50px;
border:green 1px solid;
background:#99CCFF;
+position:absolute;
+left:expression(ev ......