日期:2009-01-21  浏览次数:20943 次

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(){}