昨天,今天,明天,每天的每天,你是否都多懂得一点点...

星期二, 四月 21, 2009

Ascii 码表中 0 是什么?

我知道A的ASCII 码是65, 空格是20...但是 ASCII码表中的0是什么? 不太清楚. 没研究过. 只不过刚才碰到了个搞笑的问题.

这段代码用来给HTML加乱码, 如果 random number 是0的话, 那么, 跟在那个字符后面的所有内容就会凭空消失. 字串本来应该是越加越长的, 但这回居然越加越短...神奇...

 matchString = /(<)((br\/>|\/p>|br>))/i;
  replaceString = /(<)'((br\/>|\/p>|br>))/gi;
  while (htmlCode.match(matchString)){
   
  var tempSeed = seed;
  for (i = 0; i < 20; i++){
  randomNumber = Math.floor(Math.random()*127) + 1
  if (randomNumber == 60 || randomNumber == 62){

  randomNumber++;
  }
  tempSeed += randomNumber;
  tempSeed += String.fromCharCode(randomNumber);
  }
   
  tempSeed = "<span style='font-size:0px'>" + tempSeed + "</span>"  
  htmlCode = htmlCode.replace(matchString, tempSeed + "$1'$2");
  }


--
Feng

没有评论:

其它博客地址

此博客的同步博客地址: http://fengnz.wordpress.com
这里进入我的MSN SPACE.