当前位置导航:炫浪网>>网络学院>>网页制作>>JavaScript教程

从屏幕右下角自动上升的窗口的Javascript实现

//########################################
//## FILE: dk_risingwindow.js
//## CREATED: DannyKang @ 2004-4-1
//## MODIFIED:DannyKang @ 2004-4-8
//## FUNDESC: 右下角上升的窗口
//########################################

function DK_MOVE_moveWindowUp() {
 DK_MOVE_amount = parseInt((DK_MOVE_winHeight-DK_MOVE_total) * 0.2);
 DK_MOVE_total += DK_MOVE_amount;
 if(DK_MOVE_total<DK_MOVE_winHeight && DK_MOVE_amount>0) {
  try {
  window.moveBy(0, (-1) * DK_MOVE_amount);
  }
  catch(e){
  }
 }
 else {
  clearInterval(DK_MOVE_handle);
 }
}


var DK_MOVE_amount=0;
var DK_MOVE_total=0;
var DK_MOVE_handle ;
var DK_MOVE_winHeight, DK_MOVE_winWidth;

//启动滚动窗口
function DK_MOVE_START(){
 DK_MOVE_winHeight= document.body.offsetHeight + 30;
 DK_MOVE_winWidth = document.body.offsetWidth + 10 ;
 window.moveTo(window.screen.availWidth-DK_MOVE_winWidth, window.screen.availHeight);
 DK_MOVE_handle = setInterval("DK_MOVE_moveWindowUp()",70);
}

document.body.oncontextmenu = new Function("return false;");
document.body.onselectstart =  new Function("return false;");
document.body.onload =  new Function("return DK_MOVE_START();");

/*调用方法*/
请在需要自动上升的页面内加入以下代码:
<SCRIPT language=javascript src="index_js/dk_risingwindow.js"></SCRIPT>

相关内容
赞助商链接