javascript子页面刷新父页面
前台页面为 子页面为一个按钮:
<form id="form1" runat="server">
<div>
<asp:Button runat="server" ID="Bt_Add" Text="添加" Width="80px" Height="20px" OnClick="Bt_Add_Click" />
</div>
</form>
在后台onClick中添加:
protected void Bt_Add_Click(object sender, EventArgs e)
{
//你要做的事情然后刷新父页面
//刷新父页面
ClientScript.RegisterStartupScript(this.GetType(), "ReLoad", "ReLoad();", true);
}
在子页面加入javascript脚本
<script type="text/javascript" language="javascript">
function ReLoad() {
if(window.opener)
{//如果父页面还在的话
window.opener.location.reload();//先刷新父页面
window.opener = null;//
window.close();//这两句是为了不出现提示
}
}
</script>
点击时会摔新父页面。在关闭本页面!
相关文档:
scrollHeight: 获取对象的滚动高度。
scrollLeft:设置或获取位于对象左边界和窗口中目前可见内容的最左端之间的距离
scrollTop:设置或获取位于对象最顶端和窗口中可见内容的最顶端之间的距离
scrollWidth:获取对象的滚动宽度
offsetHeight:获取对象相对于版面或由父坐标 offsetParent 属性指定的父坐标的高度
offsetL ......
1.使用 使用Response.Write,这种方法会把JS代码写在页面的最顶部(的前面):
2. 使用: page.ClientScript.RegisterStartupScript(); 这种方法会把JS代码嵌入在页面的底部、表单的最后 (前面),适用于要在页面控件加载完成后运行的JS代码
3.使用RegisterClientScriptBlock();这种方法会把JS代码嵌入在页面的顶部、 ......
转化为Boolean类型
所有JavaScript中的值都能隐式的转化为Boolean类型,比如:
0 == false; // true
1 == true; // true
'' == false // true
null == false // true
但是这些值都不是Boolean类型。
因此当我们使用三个等 ......
var a = document.getElementById("left");
var b = document.getElementById("right");
if(a.scrollHeight < b.scrollHeight)
{
a.style.height = b.scrollHeight+”px”;
} &nb ......
// 下拉列表类
// PubEdition: Version 1.0.0.0
// ModifyDate: 2009-12-09 9:30:00
// FinishDate: 2009-12-09 9:30:00
// AuthorName: binbin( Mail:pl45@163.com / Tel:13893302154 )
var droplistswap=function(){};
droplistswap.prototype.originalElement=new Array();
// droplistswap.prototype.hidedropl ......