<%
String ss = "123";
%><input type="button" name="addroles" value="增加" onclick="showorhidden(<%=ss%>)">就这么一段简单的代码,运行时察看源代码就死活不把<%=ss%>解释成123,为什么呢,请大虾指点。

解决方案 »

  1.   

    showorhidden( <%=ss% >)" > 在你的ss% > 之间有个空格,不能有空格
      

  2.   

    <%String s="string";%>
    <input type="button" onclick="showValue('<%=s%>');"/><script>
    function showValue(a){
      alert(a);
      }
    </script>
      

  3.   

    公布正解我原来的代码是:
    <html:button property="submit5" styleClass="BUTTN-FIX1" onclick="showorhidden('<%=index.intValue()%>');">保存草稿</html:button>这样就死活解释不了<%=index.intValue()%>这个值
    后来改成以下的就行了
    <input type="button" name="addroles" value="增加角色" onclick="showorhidden('<%=index.intValue()%>');" class="BUTTN-FIX1">哎,代码真是会搞死人的东西,不过有时候,编程确实是不能钻牛角尖的东西,要学会放下,现在搞不出来,那就放到明天再做吧,一定可以解决的。谢谢楼上几位的关注。