A:刷新和重新向服务器发一次请求区别
Q:刷新不会丢失request中的参数。而重新向服务器发出一次请求,request中的参数会被覆盖。
A:子页面如何部分刷新父页面?
Q:
1.刷新本页面:
response.Write("window.document.location.reload();");
Response.End() //如果终止的话加此句
2.刷新父页面:
this.Response.Write("<script language='javascript'>window.parent.opener.document.frmMain.submit();"
+ "window.parent.close();</script>");
在子页面的cs中的Page_Load:
if (!IsPostBack)
{
CloseButton.Attributes.Add("onclick","_SetValue();");
}
在子页面的客户端:
<script language="javascript">
function _SetValue()
{
var lblRelated = window.opener.document.getElementById('Related');
var lblQuery = document.getElementById('Query');
lblRelated.innerText = lblQuery.innerText;
window.close();
}
</script>
A:实现页面中按钮刷新的N种方法
Q:
<input type=button value=刷新 onclick="history.go(0)">
<input type=button value=刷新 onclick="location.reload()">
<input type=button value=刷新 onclick="location=location">
<input type=button value=刷新 onclick="location.assign(location)">
<input type=button value=刷新 onclick="document.execCommand('Refresh')">
<input type=button value=刷新 onclick="window.navigate(location)">
<input type=button value=刷新 onclick="location.replace(location)">
<input type=button value=刷新 onclick="window.open('自身的文件','_self')">
<input type=button value=刷新 onClick=document.all.WebBrowser.ExecWB(22,1)>
<OBJECT classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 id=WebBrowser width=0></OBJECT>
<form action="自身的文件">
<input type=submit value=刷新>
</form>
<a id=a1 href="自身的文件"></a>
<input type=button value=刷新 onclick="a1.click()">
A:JavaScript实现页面刷新
Q:
location.reload和history.go(0)
不过后者有个好处,能保持页面滚动条的位置
location.href = location.href
这在弹出窗口里刷页面有效,而前两者会失效