Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/37.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net 为一个页面执行一次脚本_Asp.net_Jquery - Fatal编程技术网

Asp.net 为一个页面执行一次脚本

Asp.net 为一个页面执行一次脚本,asp.net,jquery,Asp.net,Jquery,我已将以下脚本添加到asp.net母版页 $(function() { $("#someDiv").someMethod(900, { chars: /\s/, doit: [" ( <a href='#' onclick='window.location.reload(true);' class='truncate_show'>more</a> . . . )", " ( . . . &l

我已将以下脚本添加到asp.net母版页

$(function() {

        $("#someDiv").someMethod(900, {
                chars: /\s/,
                doit: [" ( <a href='#' onclick='window.location.reload(true);' class='truncate_show'>more</a> . . . )", " ( . . . <a href='#' class='truncate_hide'>less</a> )"]
            });


        });
$(函数(){
$(“#someDiv”)。someMethod(900{
字符:/\s/,
doit:[“(…)”,“(…)”]
});
});
现在,当页面第一次加载时,我看到了“更多”链接。单击“更多”后,将发生回发,并再次触发脚本。单击“再次”并重新加载页面后,我希望停止执行脚本。

尝试不实际发生,这样您就可以只获得
onclick
事件,也可以在触发事件后尝试使用
.die()
解除绑定(但在停止链接关闭后,您可能不需要这样做)


在jQuery文档中签出事件/骰子。

< P>如果您只想在页面的第一个负载上设置它,您可以考虑通过<代码> clitScript。ReistStastutuScript()/<代码> <代码> Page加载> <代码>,在<代码>中!iPostback有条件

最终,如果您能够将显示/隐藏功能完全保留在客户端上,可能会更好。在客户机和服务器之间划清界限总是很困难的

如果这没有帮助,用更多的代码更新你的问题,也许我可以给你一个更具体的答案