popup的两种方法

王朝asp·作者佚名  2006-01-09
宽屏版  字体: |||超大  

1,popup

var pop;

function window.onload() { document.all .eMeng.style.display='none'; window.setTimeout(aaa,5000); } function aaa() { var div=document.all .eMeng; var body=document.body; pop=window.createPopup(); // html=div.innerHTML; html="

ssss

open

"; pop.document.body.innerHTML=html; pop.document.body.style.border="solid 1px"; //pop.document.body.style.bgColor="#efefeb"; divTop = parseInt(div.style.top,10); divLeft = parseInt(div.style.left,10); divHeight = parseInt(div.offsetHeight,10); divWidth = parseInt(div.offsetWidth,10); docWidth = body.clientWidth; docHeight =body.clientHeight; y = parseInt(body.scrollTop,10) + docHeight + 10;// divHeight x = parseInt(body.scrollLeft,10) + docWidth - divWidth; pop.show(x, y, 180, 116, null); } function closeDiv() { window.alert('sss'); }

2,div

var divTop,divLeft,divWidth,divHeight,docHeight,docWidth,objTimer,i = 0; var div=document.getElementById("eMeng"); var body=document.body ; function getMsg() { //window.parent.frames["TopMusic"].location.href = "Top.asp" try{ divTop = parseInt(div.style.top,10); divLeft = parseInt(div.style.left,10); divHeight = parseInt(div.offsetHeight,10); divWidth = parseInt(div.offsetWidth,10); docWidth = body.clientWidth; docHeight = body.clientHeight; div.style.top = parseInt(body.scrollTop,10) + docHeight + 10;// divHeight div.style.left = parseInt(body.scrollLeft,10) + docWidth - divWidth; div.style.visibility="visible"; objTimer = window.setInterval("moveDiv()",10); } catch(e){} } function resizeDiv() { i+=1; if(i>888) closeDiv(); try{ divHeight = parseInt(div.offsetHeight,10); divWidth = parseInt(div.offsetWidth,10); docWidth = body.clientWidth; docHeight = body.clientHeight; div.style.top = docHeight - divHeight + parseInt(body.scrollTop,10); div.style.left = docWidth - divWidth + parseInt(body.scrollLeft,10); } catch(e){} } function moveDiv() { try { if(parseInt(div.style.top,10) <= (docHeight - divHeight + parseInt(body.scrollTop,10))) { window.clearInterval(objTimer); objTimer = window.setInterval("resizeDiv()",1); } divTop = parseInt(div.style.top,10); div.style.top = divTop - 1; } catch(e){} } function closeDiv() { div.style.visibility='hidden'; if(objTimer) window.clearInterval(objTimer); } window.onload = getMsg; window.onresize = resizeDiv; window.onerror = function(){}

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
© 2005- 王朝网络 版权所有