您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

js实现页面刷新滚动条位置不变

2024/3/16 20:47:31发布19次查看
今天因为这个问题困扰了很久网上的例子都尝试没效果,后来发现一点原来是内容最外层没有div的原因
<%@ page language="c#" autoeventwireup="true" codebehind="spotchkdetail.aspx.cs" inherits="topevery.dum.web.observer.spotchkdetail" %> <script runat="server"> protected override bool headerscriptfilter(topevery.framework.web.configuration.script val) { switch (val.key) { case "ajaxpro2.prototype": case "ajaxpro2.core": case "ajaxpro2.converter": case "ajaxpro2.onloading": case "ajaxpro2.assembly.ajaxfunction": case "my97": case "image": case "jquery.pagination": case "jquery.jqgrid.locale": case "jquery.jqgrid": case "jquery-load-image": case "jquery.validationengine": case "jquery.validationengine-zh": case "weibo": case "jquery.mousewheel": case "jquery.iviewer": case "jquery.gallery.singer": return true; default: return base.headerscriptfilter(val); } } protected override bool headerstylefilter(topevery.framework.web.configuration.style val) { switch (val.key) { case "jqgrid": case "jqgrid-grey": case "validationengine": return true; default: return base.headerstylefilter(val); } } </script> <!doctype html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title></title> </head> <body id="bbdy"> <form id="form1" runat="server"> <div> <div class="tui-layout-north"> <div class="tui-title"> <span class="tui-ico ico-note"></span><strong>抽查</strong> </div> <div class="" style="float: right; margin-top: -30px; z-index: 99999; position: relative;"> <object id="webbrowser" classid="clsid:8856f961-340a-11d0-a96b-00c04fd705a2" height="0" width="0"> </object> <input type="button" class="tui-button" value="打 印" onclick="document.all.webbrowser.execwb(6, 1)" id="button2" /> <input type="button" class="tui-button" value="打印预览" onclick="document.all.webbrowser.execwb(7, 1)" /> </div> <div class="tui-alert"> <span class="ml10px">抽查时间:<asp:label id="lbbegindate" runat="server" text="label"></asp:label> 失效时间:<asp:label id="lbenddate" runat="server" text="label"></asp:label> 消息内容:<asp:label id="lbcontent" runat="server" text="label"></asp:label></span> <div style="display: none"> <asp:button id="btnref" runat="server" onclick="btnref_click" text="刷新" /> </div> </div> </div> <div class="tui-layout-center"> <div class="tui-content tui-h100 tui-of-auto tui-align-center"> <asp:repeater id="repeater1" runat="server" onitemdatabound="repeater1_itemdatabound"> <%--onitemcommand="repeater1_itemcommand"--%> <headertemplate> <table class="tui-grid-list w100" id="observers"> <tr> <th style="width: 150px">巡查员头像 </th> <th style="width: 80px">姓 名 </th> <th style="width: 120px">是否超时 </th> <%--<th style="width: 110px">城管通号码 </th> <th style="width: 110px">城管通版本 </th>--%> <th style="width: 100px">消息状态 </th> <th style="width: 100px">审核状态 </th> <th style="width:150px">审核 </th> </tr> </headertemplate> <itemtemplate> <tr class="people_title_td"> <td rowspan="2" valign="middle" style="width: 110px"> <img id="img_observer_poto" runat="server" height="135" style="border: 1px solid #bababa;" width="100" /> </td> <td style="width: 60px"> <%# eval("c_name")%> <asp:hiddenfield id="hfobid" runat="server" value='<%# eval("c_ob_id") %>' /> <asp:hiddenfield id="hfid" runat="server" value='<%# eval("c_id") %>' /> </td> <td style="width: 100px"> <%# eval("c_is_over_time")%> </td> <%--<td style="width: 110px"> <%# eval("c_pda_number")%> </td> <td style="width: 110px"> <%# eval("c_pda_version")%> </td>--%> <td style="width: 90px"> <%# eval("notify_state")%> </td> <td style="width: 90px"> <%# eval("eligible_state")%> </td> <td style="width:150px;"> <div style="display:<%# eval("c_is_eligible").tostring() !="0"?"none":"" %>"> <%--<asp:linkbutton id="linkbutton1" runat="server" commandname="lnk_poto" commandargument='<%# eval("c_id") %>'>重摄</asp:linkbutton> <asp:linkbutton id="linkbutton2" runat="server" commandname="lnk_ok" commandargument='<%# eval("c_id") %>'>合格</asp:linkbutton> <asp:linkbutton id="linkbutton3" runat="server" commandname="lnk_no" commandargument='<%# eval("c_id") %>'>不合格</asp:linkbutton>--%> <a href='#' onclick='review(<%# eval("c_id") %>,0,"重摄")' class='tui-toolbar-btn'><span></span>重摄</a> <a href='#' id="qualified" onclick='review(<%# eval("c_id") %>,1,"合格")' class='tui-toolbar-btn'><span></span>合格</a> <a href='#' id="unqualified" onclick='review(<%# eval("c_id") %>,2,"不合格")' class='tui-toolbar-btn'><span></span>不合格</a> </div> </td> </tr> <tr class="alt_tr2"> <td colspan="5" style="height: 160px; text-align: left"> <table class="choucha-table"> <tr> <asp:repeater id="rptimg" runat="server"> <itemtemplate> <td> <div class="div_img tui-notelist-container tui-gallery choucha-img"> <div id='imge'+'<%#eval("fileid") %>'> <div class="tui-gallery-content tui-gallery-img"> <a title='点击放大' href="javascript:void(0)" sourcesrc='<%#eval("imageurl") %>' largesrc='<%#eval("imageurl") %>'><img src='<%#eval("imagethumbil") %>' /><span><%#eval("summary") %></span></a> </div> </div> </div> </td> </itemtemplate> </asp:repeater> </tr> </table> </td> </tr> </itemtemplate> <footertemplate> </table> </footertemplate> </asp:repeater> <input type="hidden" id="hdnvalue" runat="server" value="0" /><!----存放scorlltop值--> </div> </div> </div> <script type="text/javascript"> $(document).ready(function () { tuilayout("form"); //loadimage(); $(".div_img").gallery({ gallerysize: { width: 90, height: 120 }, fullview: "true" //ture为允许点击图像全屏浏览 }); }); function loadimage() { var jq_o_list = $("#observers div[@ref_id]"); for (var i = 0 ; i < jq_o_list.length; i++) { load_to(jq_o_list[i]); } } function load_to(obj) { var jq_o = $(obj); topevery.dum.web.ajaxfunction.getevtdefault(jq_o.attr("ref_id"), function (ajaxresult) { var val = ajaxresult.value; jq_o.empty(); jq_o.append(val.html); }); } //$("#div_evt_img").gallery({ // images: evt_img_list, // thumbsize: { width: 65, height: 60 },//缩略图大小 // gallerysize: { width: 380, height: 280 },//画廊图(中间大图)大小 // thumbdisplaynum: 4,//缩略图显示数量 // scalingsize: { width: 360, height: 260 },//画廊图(中间大图)自动比例缩放最大大小 // fullview: "true" //ture为允许点击图像全屏浏览 //}); function reminder() { notselectevt("已经再次发送消息通知巡查员!"); } function review(id, type, content) { if (confirml("确认" + content + "吗?", function () { topevery.dum.web.ajaxfunction.reviewimg(id, type); $("#btnref").click(); })) { } } </script> </form> </body> </html> <script type="text/javascript"> window.onbeforeunload = function () { var scrollpos; if (typeof window.pageyoffset != 'undefined') { scrollpos = window.pageyoffset; } else if (typeof document.compatmode != 'undefined' && document.compatmode != 'backcompat') { scrollpos = document.documentelement.scrolltop; } else if (typeof document.body != 'undefined') { scrollpos = document.body.scrolltop; } document.cookie = "scrolltop=" + scrollpos; //存储滚动条位置到cookies中 } window.onload = function () { if (document.cookie.match(/scrolltop=([^;]+)(;|$)/) != null) { var arr = document.cookie.match(/scrolltop=([^;]+)(;|$)/); //cookies中不为空,则读取滚动条位置 document.documentelement.scrolltop = parseint(arr[1]); document.body.scrolltop = parseint(arr[1]); } } </script>
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product