Rex

——生命不止,奋斗不息。
posts - 27, comments - 8, trackbacks - 0, articles - 0
  BlogJava :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理

窗口控制JS代码集锦

Posted on 2006-11-14 11:19 W.R 阅读(386) 评论(0)  编辑  收藏 所属分类: 支持技术

//本窗口(弹出窗口)关闭,刷新父窗口
<script>window.opener.parent.location.reload();window.close()</script>

//后退一页
<a href="javascript:history.go(-1);">返回前页</a>

//新弹出窗口
<script language=JavaScript>
function newin(url,name,size)
{
 var windowname=window.open(url,name,"left=0,top=0,status=no,scrollbars=no,resizable=no,"+size);
}
</script>
<a href=Javascript:newin('x.htm','Review','width=500,height=400')>查看简介</a>

//页面自动返回
<meta http-equiv="refresh" content="1;url=bigclass.asp">
<p align=center><font color=red>恭喜您!您选择的大类已经被删除!<br>1秒钟后返回上页!</font>

//关闭窗口
<a href="javascript:window.close();">点击这里关闭本窗口</a>

//载入时弹出窗口
<script language="JavaScript">
window.open('http://www.leshanju.6to23.com/','','toolbar,menubar,scrollbars,resizable,status,location,directories,copyhistory

,height=400,width=750');
</script>


//弹出窗口自动关闭
<script language="JavaScript">
  function close() {
  setTimeout("self.close()",10000) //毫秒
  }
</script>

<body onload="close()">

//只弹出一次的窗口
<script>

  function openwin(){
  window.open("page.html","","width=200,height=200")
  }

  function get_cookie(Name) {
  var search = Name + "=" var returnvalue = "";
  if (document.cookie.length > 0) {
  offset = document.cookie.indexOf(search)
  if (offset != -1) {
  offset += search.length
  end = document.cookie.indexOf(";", offset);
  if (end == -1)
  end = document.cookie.length;
  returnvalue=unescape(document.cookie.substring(offset, end))

  }
  }
  return returnvalue;
  }

  function loadpopup(){
  if (get_cookie("popped")=="){
  openwin()
  document.cookie="popped=yes"
  }
  }
</script>

<body onload="loadpopup()">

//控制新开窗口属性
<input type="button" Value="打开新窗口"
ONCLICK="window.open('test.htm', 'Sample',
'toolbar=yes,location=yes,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=yes,width=300,height=20

0,left=100,top=100')">

//web窗体对话框
<script language=javascript>
function logonApprove()
{
 var

result=window.showModalDialog("ubbfaces.asp",window,"scroll:no;resizable:no;help:no;status:no;dialogWidth:400px;dialogHeight:

250px");
}


只有注册用户登录后才能发表评论。


网站导航: