Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

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


Ïà¹ØÎĵµ£º

JavaScript ÅжÏä¯ÀÀÆ÷ÀàÐͼ°°æ±¾

$(document).ready(function() {
        var Sys = {};
        var ua = navigator.userAgent.toLowerCase();
        if (window.ActiveXObject)
        &nbs ......

JavaScript ¿ò¼Ü±È½Ï


JavaScript ¿ò¼Ü±È½Ï
ÏÔÖøÔöÇ¿ JavaScript ¿ª·¢µÄ¿ò¼Ü¸ÅÀÀ
Joe Lennon, Èí¼þ¿ª·¢ÈËÔ±, ×ÔÓÉÖ°ÒµÕß
¼ò½é£º ÏÖ´ú Web Õ¾µãºÍ Web Ó¦ÓóÌÐòÇãÏòÓÚÒÀÀµ´óÁ¿¿Í»§¶Ë JavaScript À´Ìṩ·á¸»µÄ½»»¥¹¦ÄÜ£¬ÓÈÆäÊÇÒì²½ HTTP ÇëÇóµÄ³öÏÖʹµÃ²»Ë¢ÐÂÒ³Ãæ¾Í¿ÉÒÔ´Ó·þÎñÆ÷¶Ë½Å±¾»òÊý¾Ý¿âϵͳ·µ»ØÊý¾Ý»òÏìÓ¦¡£ÔÚ±¾ÎÄÖУ¬Äú½«Á˽âÈçº ......

javascript ¿çä¯ÀÀÆ÷µÄʼþϵͳ4

ÉÏ´Î˵µ½ÎÒÃÇÔÚÎÞ¾ú»·¾³ÖÐÉè¼ÆÁËÒ»¸öʼþ´úÀíº¯Êý£¬µ«ÐÔÄÜÊǸöÎÊÌ⣬½â¾öËüÎÒÃÇÐèÒª»º´æ½Úµã¼¯ºÏ£¬·¢Ïֽڵ㼯ºÏ²»×ãÒÔÓ¦¶ÔÐÂÇé¿öʱ£¬ÔÙÌæ»»Õâ¸ö½Úµã¼¯ºÏ£¬ÖØÐ¿ªÊ¼Æ¥Åä¡£ÏÂÃæÊÇÐµķ½°¸£º

var delegate = function(selector,type,callback){
var els = $(selector);
addEvent(document,t ......

[ת]aspµÄtextboxµÄjavascriptÓ¦ÓÃ

<%@ 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 ......

[ת]JavaScriptÖеÄtrimº¯Êý

/**
* È¥³ý¶àÓà¿Õ¸ñº¯Êý
* trim:È¥³ýÁ½±ß¿Õ¸ñ lTrim:È¥³ý×ó¿Õ¸ñ rTrim: È¥³ýÓÒ¿Õ¸ñ
* Ó÷¨£º
*     var str = "  hello ";
*     str = str.trim();
*/
String.prototype.trim = function()
{
    return this.replace(/(^[\\s]*)|([\\s]*$)/g, ""); ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ