怎样在onclick事件函数中传递参数? 我试了 只能传递字符串常量,传递变量就不行 为什么? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <%String qq="retert";%> <img style="cursor:hand" onclick="yy(qq);" src="imagebangdan/shiting.jpg" width="20" height="20"/>=============================function yy(tt){alert(tt);} 比如这样就不行 <html><head><script> cal = function(obj){ alert(obj.value); };</script></head><body><input type="button" onclick="cal(this)" value="按钮"/></body><html> 那是肯定的,你的qq是asp的变量, <%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);} 为什么我那就不行? 而把onclick="yy(qq);" 中的qq换成="retert"就行了 asp是服务器端语言,js是客户端语言,分开定义肯定不能简单互读,就像那个笑话是这样的张总,你在家里的电脑上按了CTRL+C,然后在公司的电脑上再按CTRL+V是肯定不行的。即使同一篇文章也不行。不不,多贵的电脑都不行 如何使easyui datagrid控件的一列(column)成为可链接? removeChild 循环删除结点,删不干净 关于FF菜单里的"建立图库"功能 flash显示为灰色的问题 如何实现这样的功能 session 问题 讨论提交 onsubmit onclick 请问怎么样实现右击全选的功能? 怎样在关闭子窗口的时候同时也把父窗口也关了 Text框的属性方法 -- 还有什么? 求javascript解决方法 保留1位小数的Jquery
String qq="retert";
%>
<img style="cursor:hand" onclick="yy(qq);" src="imagebangdan/shiting.jpg" width="20" height="20"/>=============================
function yy(tt){
alert(tt);
}
比如这样就不行
<head>
<script>
cal = function(obj){
alert(obj.value);
};
</script>
</head><body>
<input type="button" onclick="cal(this)" value="按钮"/>
</body>
<html>
那是肯定的,你的qq是asp的变量,
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);
}