<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
click the text field, why it does NOT alert 153 ?<br />
<input type="text" value="&#153;" onclick="alert(this.value.charCodeAt(0));" />
</body>
</html>

解决方案 »

  1.   

    呵呵,lz 好像没弄清楚一些概念charCodeAt 方法
    返回一个整数,代表指定位置上字符的 Unicode 编码。而 &#153; 是实体字符代码,并非 Unicode 编码!因此结果肯定不一样滴!
      

  2.   

    你把 value="&#153;"  改成 value="&#8482;" 看看 效果一样
      

  3.   

    是的, 不过实体代码不就是: &# + unicode + ; 么?
      

  4.   

    是的, 不过实体代码不就是: &# + unicode + ; 么?当然不是!!!HTML 4.01 Entities Referencehttp://www.w3schools.com/tags/ref_entities.asplz 仔细看看吧!