页面打开飘动的窗口

- 中国WEB开发者网络 (http://www.webasp.net)
-- 网页特效 (http://www.webasp.net/javascript/)
--- 页面打开飘动的窗口 (http://www.webasp.net/javascript/1/623.htm)
-- 发布日期: 2005-06-22
<!-- 网页特效代码由[中国WEB开发者网络:http://www.ChinaWebDev.com]提供! -->
<!-- 要实现此效果需要 2 个步骤: -->

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

<BODY onload="doFlyMe()">



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

<script>

var URL= "flyingwindow_show.html";

// Set size of popup
var W= 130; // not less than 100
var H= 180; // not less than 100

// Set margin from edge of screen
var M= 100;

// Set speed
var speed = 20;

// Set increment of motion
var increment = 16;

// Do not edit below this line
//============================
var nowY=M;var nowX=M;
var theWidth=window.screen.width;
var theHeight=window.screen.height;
var limitX=theWidth-W-M;
var limitY=theHeight-H-M;
var s="width="+W+",height="+H;
function doFlyMe(){
P=window.open(URL,"A",s);
P.resizeTo(W,H);
P.moveTo(M,M);
P.focus();
D();}
function D(){
if (nowY<=limitY){
P.moveTo(nowX,nowY);
P.focus();
nowY+=increment;
T=setTimeout("D()",speed);
}else{
clearTimeout(T);
nowY=limitY;
P.moveTo(nowX,nowY);
P.focus();
R();}}
function R(){
if (nowX<=limitX){
P.moveTo(nowX,nowY);
P.focus();
nowX+=increment;
T=setTimeout("R()",speed);
}else{
clearTimeout(T);
nowX=limitX;
P.moveTo(nowX,nowY);
P.focus();
U();}}
function U(){
if (nowY>=M){
P.moveTo(nowX,nowY);
P.focus();
nowY-=increment;
T=setTimeout("U()",speed);
}else{
clearTimeout(T)
nowY=M;
P.moveTo(nowX,nowY);
P.focus();
L();}}
function L(){
if (nowX>=M){
P.moveTo(nowX,nowY);
P.focus();
nowX-=increment;
T=setTimeout("L()",speed);
}else{
clearTimeout(T);
nowX=M;
P.moveTo(nowX,nowY);
P.focus();}}

</script>



webasp.net