我摇javascipt的这个位在< HEAD>
我的网页的部分:
I'm rocking this bit of Javascipt in the <head>
section of my page:
<script type="text/javascript">
$(document).ready(function() {
$('dl.expander dd').expander
(
{ slicePoint: 50, widow: 2, expandEffect: 'show', userCollapseText: '[^]' }
);
});
</script>
这伟大工程的第一次加载页面;然而,当我点击了&LT; ASP:按钮&GT;
这是一个&LT内部; ASP:UpdatePanel的&GT;
页是局部刷新,但 $(文件)。就绪
永远不会再次调用。
This works great the first time the page is loaded; however, when I click an <asp:button>
that is inside an <asp:updatepanel>
the page is partially refreshed, but the $(document).ready
is never called again.
这是很重要的,因为这个JavaScript在 $(文件)。就绪
部分坍塌,并加入了readmore选项pararaphs(或DL的与名单页面,其中大部分应该是默认瘫倒在类=膨胀)。
This is important, because this Javascript in the $(document).ready
section is collapsing and adding a "readmore" option to a list of pararaphs (or dl's with class="expander") on the page, most of which should be collapsed by default.
您将需要一个处理程序添加到了AJAX客户端endRequest事件。更多信息请参见下面的链接。当AJAX发动机完成一个请求到服务器,并且是必要的有关内容的更新面板内的任何的javascript运行此事件将被调用。
You will need to add a handler to the AJAX client side endRequest event. See the links below for more information. This "event" is called when the ajax engine completes a request to the server, and is necessary for any javascript running on content that is inside the update panel.
http://www.asp.net/ajax/documentation/live/overview/AJAXClientEvents.aspx
http://msdn.microsoft.com/en-us/library/bb383810.aspx
<script type="text/javascript">
$(function() {
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
});
function EndRequestHandler(sender, args) {
// code that you want to run when the request is complete
}
<script>