随笔 - 154  文章 - 0  评论 - 55  阅读 - 65万

实现在页面中单击按钮关闭页面

1> 在aspx页面中要实现单击一个按钮(服务器端控件)来关闭当前页面,只需要在aspx页面的page_load()方法中加入下列语句:
this.btnClose.Attributes.Add("onclick","window.close()");//btnClose是按钮的名字,此语句是给其添加一个单击属性,调用window.close()方法。
2> 在html页面中要实现单击一个按钮(html控件)来关闭当前页面,只需要在html代码中的按钮控件代码中添加一个onclick属性即可,代码如下:
< INPUT id="Button1" type="button" value="Button" name="Button1" onclick="window.close()">

posted on 2006-05-29 17:21  lui  阅读(10891)  评论(0)    收藏  举报
< 2006年5月 >
30 1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31 1 2 3
4 5 6 7 8 9 10

点击右上角即可分享
微信分享提示