我试了 只能传递字符串常量,传递变量就不行 为什么?

解决方案 »

  1.   

    <%
    String qq="retert";
    %>
     <img style="cursor:hand" onclick="yy(qq);" src="imagebangdan/shiting.jpg" width="20" height="20"/>=============================
    function yy(tt){
    alert(tt);
    }
     
    比如这样就不行
      

  2.   

    <html>
    <head>
    <script>
        cal = function(obj){
            alert(obj.value);
        };
    </script>
    </head><body>
    <input type="button" onclick="cal(this)" value="按钮"/>
    </body>
    <html>
      

  3.   


    那是肯定的,你的qq是asp的变量,
      

  4.   

    <%
    String qq="retert";
    %>
     <img style="cursor:hand" onclick="yy(qq);" src="imagebangdan/shiting.jpg" width="20" height="20"/>=============================
    var qq=<%=qq%>
    function yy(tt){
    alert(tt);
    }
      

  5.   

    为什么我那就不行? 而把onclick="yy(qq);" 中的qq换成="retert"就行了 
      

  6.   

    asp是服务器端语言,js是客户端语言,分开定义肯定不能简单互读,就像那个笑话是这样的张总,你在家里的电脑上按了CTRL+C,然后在公司的电脑上再按CTRL+V是肯定不行的。即使同一篇文章也不行。不不,多贵的电脑都不行