javascriptʵÏÖkey value¶ÔÏó
JavaScriptµÄʵÏÖµÄMap£¬ÓÃ×Åͦ·½±ãµÄ£¬²»ÖªµÀÐÔÄÜÔõôÑù¡£
×Ô¼ºÓÃÖ»Óв»³¬¹ý10¸öÔªËØ£¬ËùÒÔÐÔÄÜÎÞËùνÁË¡£
/********************jsmap.js**************************/
/////// map Àà
function classMap() {
this.map = new Array();
var struct = function(key,
value){
this.key = key;
this.value = value;
};
this.lookUp = function (key){
for (var i = 0; i <
this.map.length; i++)
{
if ( this.map[i].key === key )
{
return this.map[i].value;
}
}
return null;
};
this.setAt = function (key, value){
for (var i = 0; i
< this.map.length; i++)
{
if ( this.map[i].key === key )
{
this.map[i].value = value;
return;
}
}
this.map[this.map.length] = new struct(key,value);
};
this.removeKey = function removeKey(key){
var v;
for (var i =
0; i < this.map.length; i++)
{
v = this.map.pop();
if
( v.key === key )
continue;
this.map.unshift(v);
}
};
this.getCount = function(){
return
this.map.length;
};
this.isEmpty = function(){
return this.map.length <= 0;
};
}
////////////////////////////////////////////////////////////////////////////////////////////////
/********************µ÷ÓÃ***********************/
window.onload = function(){
var map = new classMap();
alert("is the map empty? " +
map.isEmpty());
// string to array
map.setAt("sw1", "aaaa
Ïà¹ØÎĵµ£º
±äÁ¿µÄ×÷ÓÃÓòÖ¸µÄÊDZäÁ¿µÄ¿É¼ûÐÔ£¬¶øÉúÃüÖÜÆÚÔò£¨´æ»îÆÚ£©ÔòÊÇ´ÓÁíÒ»¸ö½Ç¶È¿¼²ì±äÁ¿¡£ jsÖбäÁ¿µÄ×÷ÓÃÓò·ÖΪȫ¾Ö±äÁ¿ºÍ¾Ö²¿±äÁ¿£¬º¯ÊýÄÚ¶¨ÒåµÄ³ÆÎª¾Ö²¿±äÁ¿£¬º¯ÊýÍâµÄ³ÆÎªÈ«¾Ö±äÁ¿¡££¨¡°º¯ÊýÍâµÄ³ÆÎªÈ«¾Ö±äÁ¿¡±ÊÇÏà¶ÔµÄ£¬Áí´Ë´¦ÌÖÂÛµÄǰÌáÊÇÓÃvarÏÔʽÉùÃ÷µÄ±äÁ¿£¬º¯ÊýÄÚ²»ÓÃvar¶¨ÒåµÄ±äÁ¿Ä¬ÈÏÊÇÈ«¾Ö±äÁ¿£¬µ±È»ºöÂÔvarÉùÃ÷± ......
ÒªÏëд³ö¿çä¯ÀÀÆ÷µÄjavascript£¬¾Í±ØÐë¶®µÃÐá̽¼¼Êõ¡£ÕâÊÇä¯ÀÀÆ÷´óÕ½ÒÅÁôϵĴóµØÀ×£¬ÊÂÒÑÈç´Ë£¬Ö»ºÃÈÏÃü£¬¹Ô¹Ôд·ÖÖ§½á¹¹°É£¬º¯Êý¾ÍÊÇÕâÑù²»Öª²»¾õÖб䳤µÄ¡£
ÏÈ¿´µ¥Ò»ä¯ÀÀÆ÷µÄÅжϣ¬ÎÒÃÇûÓбØÐëÈ¥ÕÒnavigator.userAgentµÄÂé·³£¬ÎÒÔÚ¹úÍâµÄ²©¿ÍÍøÕ¾ÊÕ¼¯ÁËÈçÏÂhack£¬¶ÌС¾«º·£º
ie = !+"\v1" ;
ie ='\v'=='v' ; ......
ÒÔÏ·ֱðÊÇÓõݹéºÍÁ½ÖÖÑ»·¶Ôì³²¨ÄÇÆõÊýÁеļòµ¥ÊµÏÖ¡£(½á¹û½ö¹©²Î¿¼)
µÝ¹éµÄģʽ£º
function Fibonacci(num){
if(num <= 2){
return 1;
}else{
return Fibonacci(num - 1) + Fibonacci(num - 2)
}
}
var counter1 = new Counter();
Fibonacci(30);
counter1.show()
//Firefo ......
Õⲿ·Ö˵һÏÂ×î½ü·Ç³£Á÷ÐеÄʼþ´úÀí¡£Ê¼þ´úÀíµÄʵÏÖ¼òµ¥À´Ëµ£¬ÊǰÑʼþ°ó¶¨µ½Ä¿±êÔªËØµÄ׿ÏÈÔªËØÉÏ£¬È»ºóͨ¹ýðÅÝ»ò²¶»ñµÃµ½Ê¼þÔ´£¬È»ºóÔÙÅж¨Ê¼þÔ´ÊÇ·ñµÈÓÚÄ¿±êÔªËØÔÙÖ´Ðлص÷º¯Êý¡£ÓÉÓÚ¶ÔÄ¿±êÔªËØµÄÅж¨ÓÐʱ·Ç³£Ä£ºý£¬Òò´Ëͨ¹ýÅж¨¼´¿Éµ÷Óûص÷º¯Êý£¬ÕâÑù£¬ÎÒÃǾʹﵽһ¸ö¼àÌýÆ÷ΪÐí¶àʼþÔ´·þÎñµÄÄ¿µÄ¡£¶ÔÓÚÐÔÄÜÒ»Ïò ......
<%@ Page Language="C#" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server"> </script>
<html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server">
<title ......