当前位置:开发者网络 >> 网页特效 >> 浏览窗口 >> 内容
精彩推荐
分类最新特效
分类热点特效
  
打开窗口向右移动
日期:2005-06-22   人气:   【字体: 】【收藏此文


<!-- 网页特效代码由[中国WEB开发者网络:http://www.ChinaWebDev.com]提供! -->
<!-- 要实现此效果需要 2 个步骤: -->

<!-- 第 1 步: -->
<!-- 把<BODY>中的属性代码改为: -->

<BODY bgcolor="#fef4d9" onLoad="showWindow()">



<!-- 第 2 步: -->
<!-- 把下面的代码加到<BODY></BODY>区域中: -->

<script>
<!-- Beginning of JavaScript -
// The name of the pop-up-window. Do not change it.
var popwindow

// The heiht of your pop-up-window (pixels)
var popwindowwidth=200

// The width of your pop-up-window (pixels)
var popwindowheight=200

// Distance to the top margin of the big window.
var popwindowtop=200

// The URL of the HTML-file that contains the content of the pop-up-window
var popwindowURL="tanchu.htm"

// Standstill-time (seconds)
var waitingtime=4

// Configure ths speed of the pop-up-window
var pause=20
var step=40

// Do not change this variable
var popwindowleft=-popwindowwidth-50

// Do not change this variable
var marginright

// Do not change this variable
var pagecenter

// Do not change this variable
var timer

waitingtime= waitingtime*1000

function showWindow() {
popwindow = window.open(popwindowURL, "popwindow", "toolbar=no,width="+popwindowwidth+",height="+popwindowheight+",top="+popwindowtop+",left="+(-popwindowwidth)+"");
if (document.all) {
marginright = screen.width+50
}
if (document.layers) {
marginright = screen.width+50
}
pagecenter=Math.floor(marginright/2)-Math.floor(popwindowwidth/2)
movewindow()
}

function movewindow() {
if (popwindowleft<=pagecenter) {
popwindow.moveTo(popwindowleft,popwindowtop)
popwindowleft+=step
timer= setTimeout("movewindow()",pause)
}
else {
clearTimeout(timer)
timer= setTimeout("movewindow2()",waitingtime)
}
}

function movewindow2() {
if (popwindowleft<=marginright) {
popwindow.moveTo(popwindowleft,popwindowtop)
popwindowleft+=step
timer= setTimeout("movewindow2()",pause)
}
else {
clearTimeout(timer)
popwindow.close()
}
}

// -->
</script>