提交页面刷新后,让页面的位置还在底部??谢谢各位大虾了 底部有一个提交按钮,每提交一次可是页面又回到了开头我想实现,提交页面刷新后,让页面的位置还在底部,应该怎么实现 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 document.body.scrollBottom=document.body.clientHeightjs function scrollDiv(){ document.all.pos.value = document.all.scrollTop; }function OnlineformOnload(){ OnloadForScroll();}function OnloadForScroll(){ var spos = document.all["pos"].value; if(! spos)spos=0; document.all.onlinediv.scrollTop=spos; }<body onload="OnlineformOnload();"> 以下为经验证过的写法,确实没有问题.<script language="javascript">function GetCookie (name) { var arg = name + "="; var alen = arg.length; var clen = document.cookie.length; var i = 0; while (i < clen) { var j = i + alen; if (document.cookie.substring(i, j) == arg) { return getCookieVal (j); } i = document.cookie.indexOf(" ", i) + 1; if (i == 0) { break; } } return null;}function getCookieVal (offset) { var endstr = document.cookie.indexOf (";", offset); if (endstr == -1) endstr = document.cookie.length; return unescape(document.cookie.substring(offset, endstr));}function SetCookie (name, value) { document.cookie = name + "=" + escape (value);}</script></HEAD><body bgColor="#f1f5f5" leftMargin="0" topMargin="0" rightMargin="0" MS_POSITIONING="FlowLayout" onload="document.body.scrollTop=GetCookie('posy')" onunload="SetCookie('posy',document.body.scrollTop)"> 也可以用锚定位。。<-- Link to an anchor. --><A HREF="#anchor">anchor</A><-- Define an anchor. --><A NAME="anchor"> 把页面的智能导航打开试试在页面文件的代码中加入<%# Page ...... smartNavigation="true" %> Page.SmartNavigation = True 打开智能导航 二楼的方法用控件记录三楼用cookie记录,好方法 <%@ Page ...... smartNavigation="true" %>这个是智能导航,效果不错。。但是要在IE5或者以上版本才支持此功能 <script language="javascript"><!--//底部var doc = window.frames["in"].document;doc.onreadystatechange= function() { if(doc.readyState=="complete") doc.body.scrollTop = doc.body.scrollHeight;}//刷框架代码var icount=false;function ref(){ if(icount) { window.location="Out_Main.aspx"; } window.setTimeout("ref()",3000); icount=true;}--></script> <%@ Page ...... smartNavigation="true" %>------这种方法,在你的页面中,没有用到验证控件的时候,是很好,但如果用到验证控件,会出错. http://www.cnblogs.com/huobazi/archive/2004/09/20/44823.html *.appx......<a name='#position'></a>.......---------------------*.cs..... response.write(<script>window.location='#position';</script>"); 不要使用种:<%@ Page ...... smartNavigation="true" %>问题太多了............ void Page_Load(Object sender, EventArgs e){ this.SmartNavigation = true;} 求解DropDownList事件不激发的问题 请问如何实现发帖成功窗口? 关于部署的一个简单问题。 关于html页面表单提交到aspx页面的问题 怎样让一个方法不被同时调用(急,在线等) 我把一些服务器控件的ID存储在一个string[]数组当中,现在想将这些控件全部禁用,应该怎么写? 在ASPX页面如何调用HTC组件?? 好的,实用的,快速的asp.net教程^^^^^ 请教一下配置出现错误原因 asp.net环境设置问题 哪位好心人知道怎么在网页中连接一个影视文件吗??? 【求助】DropDownList无刷新连动问题,帮帮忙,急用,谢谢!
js
{
document.all.pos.value = document.all.scrollTop;
}
function OnlineformOnload()
{
OnloadForScroll();
}
function OnloadForScroll()
{
var spos = document.all["pos"].value;
if(! spos)spos=0;
document.all.onlinediv.scrollTop=spos;
}<body onload="OnlineformOnload();">
function GetCookie (name)
{
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen)
{
var j = i + alen;
if (document.cookie.substring(i, j) == arg)
{
return getCookieVal (j);
}
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0)
{
break;
}
}
return null;
}function getCookieVal (offset)
{
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}function SetCookie (name, value)
{
document.cookie = name + "=" + escape (value);
}
</script>
</HEAD><body bgColor="#f1f5f5" leftMargin="0" topMargin="0" rightMargin="0" MS_POSITIONING="FlowLayout" onload="document.body.scrollTop=GetCookie('posy')" onunload="SetCookie('posy',document.body.scrollTop)">
<-- Link to an anchor. -->
<A HREF="#anchor">anchor</A><-- Define an anchor. -->
<A NAME="anchor">
在页面文件的代码中加入<%# Page ...... smartNavigation="true" %>
三楼用cookie记录,
好方法
<!--//底部
var doc = window.frames["in"].document;
doc.onreadystatechange= function() {
if(doc.readyState=="complete")
doc.body.scrollTop = doc.body.scrollHeight;
}//刷框架代码var icount=false;
function ref()
{
if(icount)
{
window.location="Out_Main.aspx";
}
window.setTimeout("ref()",3000);
icount=true;
}
-->
</script>
------
这种方法,在你的页面中,没有用到验证控件的时候,是很好,但如果用到验证控件,会出错.
*.appx
..
..
..<a name='#position'></a>
....
...---------------------
*.cs
.....
response.write(<script>window.location='#position';</script>");
问题太多了............
{
this.SmartNavigation = true;
}