67,512
社区成员
发帖
与我相关
我的任务
分享
<script type="text/javascript">
var funSet={"fun1" : "alert('hello')","fun2" : "alert('asd')"}
function execute(funName){
eval(funSet["fun1"]);
}
</script>
<body>
<input type="button" name="test" onclick="execute('fun1')"/>
</body>
[/quote]
我现用的就是这种方法,但是,存在一个问题,当你打开多个有jqgrid的页面时,因为你执行的方法名开始都是一样的,这样所有页面执行的方法都会是你最后一次打开的那个jqgrid页面的方法,我现在要做的就是把每个有jqgrid页面中执行的方法不一致,这样就可以规避这种问题。
<script type="text/javascript">
var funSet={"fun1" : "alert('hello')","fun2" : "alert('asd')"}
function execute(funName){
eval(funSet["fun1"]);
}
</script>
<body>
<input type="button" name="test" onclick="execute('fun1')"/>
</body>