错误提示:the entity name must immediately follow the '&' in the entity reference代码如下:<?xml version="1.0" encoding="utf-8"?>
<bindings xmlns="http://www.mozilla.org/xbl">
<binding id="numericfield">
<implementation>
<constructor>
this.keypress = CheckIsDigit ;
</constructor>
<method name="CheckIsDigit">
<body>
var iCode = keyCode ; var bAccepted =
(
( iCode >= 48 && iCode <= 57 )
|| (iCode >= 37 && iCode <= 40) || iCode == 8 || iCode == 46) ; return bAccepted ;
   </body>
</method>
</implementation>
<events>
<event type="keypress" value="CheckIsDigit()" />
</events>
</binding>
</bindings>

解决方案 »

  1.   

    还是不行啊,&&在代码中是作为运算符使用的,用&amp这个不行!还有别的办法吗?
      

  2.   

    xml里面有些特殊字符需要转义。
    &=&amp;
    >=&gt;;
    <=&lt;
    "=&quot;
    '=&apos;
      

  3.   

    别忘了 ;    amp;
      

  4.   

    也不行,又显示另外一个错误:the content of elements must consist of well-formed character data or up,我觉得这样改好像不对,有没有高手帮忙啊?谢谢!!!
      

  5.   

    xsl吗?实验以下这个。
    <xsl:comment><![CDATA[
       funcation()...]]></xsl:comment>不行的话再试试这个<!-- -->
      

  6.   

    <![CDATA[ 
      funcation()... ]]> 
      

  7.   

    不是,是( iCode >= 48 && iCode <= 57 ) || (iCode >= 37 && iCode <= 40)这个表达式有问题,提示“the entity name must immediately follow the '&' in the entity reference”,有没有解决的办法啊?
      

  8.   

    如果有一堆的话,使用<![CDATA[
    ...
    ]]>就可以了。
      

  9.   

    ( iCode >= 48 && iCode <= 57 ) || (iCode >= 37 && iCode <= 40)
    看看&&是英文字符吗?如果是
    改成( iCode >= 48 || iCode <= 57 ) || (iCode >= 37 || iCode <= 40)
    看看还会出现那个问题吗 如果还出现说明不是那个问题
    不出现的话就用别的判断
      

  10.   

    按13楼说的方法已经解决了,太感谢你了!!!不过<![CDATA[ ... ]]>表示什么意思啊?还希望你解释一下!谢谢!!!
      

  11.   

    & 替换成  &amp; 
    > 替换成  &gt;; 
    < 替换成  &lt; 
    " 替换成  &quot; 
    ' 替换成  &apos;
      

  12.   

    hyl04是不是这要写的:
            ( iCode >= 48 <![CDATA[&&]]> iCode ≤ 57 )