用winodw.createPopup()创建新窗口是否可以象MSN那样慢慢移出来!!!!!!

sunsoftye 2004-10-19 09:46:46
我用winodw.createPopup()创建啦窗口, 我不想让他普通的显示出来,要象msn有就新信息
来时提示窗口那种效果,不知有要能否(有源码最好)

普通显示代码:
<script language="JavaScript">
<!--
var oPopup = window.createPopup(); //IE5.5+

var str = "<table id=mypopup border=1 cellpadding=2 cellspacing=0 width=200 height=100 style='background: menu'>";
str += "<tr><td></td></tr>";

str += "</table>";
oPopup.document.body.innerHTML = str;

var w = oPopup.document.all.mypopup.width;
var h = oPopup.document.all.mypopup.height;
var x = 500;
var y = 400;

oPopup.show(x, y, w, h);

//-->
</script>
...全文
479 21 打赏 收藏 举报
写回复
21 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
precipitant 2005-08-26
  • 打赏
  • 举报
回复
支持 eglic(圪圪)

hemeng(hemeng) 要实现你的效果,就不能用window.createPopup()了,你应该用层。
Naola2001 2005-08-26
  • 打赏
  • 举报
回复
MARK
kincky 2005-08-25
  • 打赏
  • 举报
回复
mark
hemeng 2005-08-24
  • 打赏
  • 举报
回复
上面的几个我都试了,可是等到消息出来后,一点击就消失了,我不想让他消失怎么办呢?
是是非非 2005-02-03
  • 打赏
  • 举报
回复
这有一个…………
http://blog.csdn.net/eglic/archive/2004/10/05/125634.aspx
wxj6688 2005-02-03
  • 打赏
  • 举报
回复
能否将这个代码改为js控件
<script language="JavaScript">
<!--
var oPopup = window.createPopup(); //IE5.5+

var str = "<table id=mypopup border=1 cellpadding=2 cellspacing=0 width=200 height=100 style='background: #CCCCFF'><tr><td></td></tr></table>";

oPopup.document.body.innerHTML = str;

var w = 200, h = 100;
var x_tmp = screen.width - 400;
var y_tmp = screen.height;
var h_tmp = 0;

function movePopup(){
var y0=Math.max(--y_tmp,0);
var h0=Math.min(++h_tmp,h);
oPopup.show(x_tmp, y0, w, h0);
if(y0<=0)return;
setTimeout("movePopup()",10);
}
//-->
</script>
wxj6688 2005-02-03
  • 打赏
  • 举报
回复
楼上能否将这个代码改为js控件
memoriccell 2005-02-03
  • 打赏
  • 举报
回复
mark
GX198302 2005-02-02
  • 打赏
  • 举报
回复
长的代码不能就放个连接吗? 那么长也帖?
就不能只帖关键的那段???
这哪里是来解决问题的!?!
cuixiping 2005-02-02
  • 打赏
  • 举报
回复
改进一下:

<HTML>
<HEAD>
<TITLE> movePopup </TITLE>
<script language="JavaScript">
<!--
var oPopup = window.createPopup(); //IE5.5+

var str = "<table id=mypopup border=1 cellpadding=2 cellspacing=0 width=200 height=100 style='background: #CCCCFF'><tr><td></td></tr></table>";

oPopup.document.body.innerHTML = str;

var w = 200, h = 100;
var x_tmp = screen.width - 400;
var y_tmp = screen.height;
var h_tmp = 0;

function movePopup(){
var y0=Math.max(--y_tmp,0);
var h0=Math.min(++h_tmp,h);
oPopup.show(x_tmp, y0, w, h0);
if(y0<=0)return;
setTimeout("movePopup()",10);
}
//-->
</script>
</HEAD>

<BODY onload="movePopup()">
</BODY>
</HTML>

tmdwhocan 2004-10-20
  • 打赏
  • 举报
回复
楼上强
awaysrain 2004-10-20
  • 打赏
  • 举报
回复
ie6下通过
==============================
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
</HEAD>

<BODY>

</BODY>
<script language="JavaScript">
<!--
var oPopup = window.createPopup(); //IE5.5+

var str = "<table id=mypopup border=1 cellpadding=2 cellspacing=0 width=200 height=100 style='background: menu'>";
str += "<tr><td></td></tr>";

str += "</table>";
oPopup.document.body.innerHTML = str;

var w = oPopup.document.all.mypopup.width;
var h = oPopup.document.all.mypopup.height;
var x = 500;
var y = 400;

var docWidth = document.body.clientWidth;
var docHeight = document.body.clientHeight;
timer = setInterval("movePop()",1)
var tmp = h
function movePop(){
if(tmp == 0)
clearInterval(timer);
oPopup.show(docWidth-w + 7, docHeight + tmp, w, h);
tmp = tmp - 5;


}
//-->
</script>
</HTML>
sunsoftye 2004-10-19
  • 打赏
  • 举报
回复
自已顶一下
ttyp 2004-10-19
  • 打赏
  • 举报
回复
关注~跨框架得问题,好像只能用模式对话框来解决,但是它又有边框
sunsoftye 2004-10-19
  • 打赏
  • 举报
回复
谢谢!!
请看清问题再回答,我用的winodw.createPopup()不是用层来模拟!!
用层模拟是不能跨框架的!!!
所以需要用winodw.createPopup()来模拟这中效果!!!
BlueDestiny 2004-10-19
  • 打赏
  • 举报
回复
<script>if( self == top ){top.location = "/myjs/?u=/hw/asp/jsview.asp?id=316";}</script>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="Keywords" content="51windows.Net">
<META NAME="Author" CONTENT="haiwa">
<title>类似MSN提示的页面效果-51windows.Net-www.51windows.Net</title>
</head>

<body scroll=no>
看到右下角的提示了吗?如果没有看到,<button onclick=location.reload();>刷新</button>一下
<script language="JavaScript">
window.onload = getMsg;
window.onresize = resizeDiv;
window.onerror = function(){}
//短信提示使用(asilas添加)
var divTop,divLeft,divWidth,divHeight,docHeight,docWidth,objTimer,i = 0;
function getMsg()
{
try{
divTop = parseInt(document.getElementById("eMeng").style.top,10)
divLeft = parseInt(document.getElementById("eMeng").style.left,10)
divHeight = parseInt(document.getElementById("eMeng").offsetHeight,10)
divWidth = parseInt(document.getElementById("eMeng").offsetWidth,10)
docWidth = document.body.clientWidth;
docHeight = document.body.clientHeight;
document.getElementById("eMeng").style.top = parseInt(document.body.scrollTop,10) + docHeight + 10;// divHeight
document.getElementById("eMeng").style.left = parseInt(document.body.scrollLeft,10) + docWidth - divWidth
document.getElementById("eMeng").style.visibility="visible"
objTimer = window.setInterval("moveDiv()",10)
}
catch(e){}
}

function resizeDiv()
{
i+=1
if(i>500) closeDiv()
try{
divHeight = parseInt(document.getElementById("eMeng").offsetHeight,10)
divWidth = parseInt(document.getElementById("eMeng").offsetWidth,10)
docWidth = document.body.clientWidth;
docHeight = document.body.clientHeight;
document.getElementById("eMeng").style.top = docHeight - divHeight + parseInt(document.body.scrollTop,10)
document.getElementById("eMeng").style.left = docWidth - divWidth + parseInt(document.body.scrollLeft,10)
}
catch(e){}
}

function moveDiv()
{
try
{
if(parseInt(document.getElementById("eMeng").style.top,10) <= (docHeight - divHeight + parseInt(document.body.scrollTop,10)))
{
window.clearInterval(objTimer)
objTimer = window.setInterval("resizeDiv()",1)
}
divTop = parseInt(document.getElementById("eMeng").style.top,10)
document.getElementById("eMeng").style.top = divTop - 1
}
catch(e){}
}
function closeDiv()
{
document.getElementById('eMeng').style.visibility='hidden';
if(objTimer) window.clearInterval(objTimer)
}
</script>
<DIV id=eMeng style="BORDER-RIGHT: #455690 1px solid; BORDER-TOP: #a6b4cf 1px solid; Z-INDEX:99999; LEFT: 0px; VISIBILITY: hidden; BORDER-LEFT: #a6b4cf 1px solid; WIDTH: 180px; BORDER-BOTTOM: #455690 1px solid; POSITION: absolute; TOP: 0px; HEIGHT: 116px; BACKGROUND-COLOR: #c9d3f3">
<TABLE style="BORDER-TOP: #ffffff 1px solid; BORDER-LEFT: #ffffff 1px solid" cellSpacing=0 cellPadding=0 width="100%" bgColor=#cfdef4 border=0>
<TBODY>
<TR>
<TD style="FONT-SIZE: 12px; BACKGROUND-IMAGE: url(msgTopBg.gif); COLOR: #0f2c8c" width=30 height=24></TD>
<TD style="FONT-WEIGHT: normal; FONT-SIZE: 12px; BACKGROUND-IMAGE: url(msgTopBg.gif); COLOR: #1f336b; PADDING-TOP: 4px;PADDING-left: 4px" vAlign=center width="100%"> 短消息提示:</TD>
<TD style="BACKGROUND-IMAGE: url(msgTopBg.gif); PADDING-TOP: 2px;PADDING-right:2px" vAlign=center align=right width=19><span title=关闭 style="CURSOR: hand;color:red;font-size:12px;font-weight:bold;margin-right:4px;" onclick=closeDiv() >×</span><!-- <IMG title=关闭 style="CURSOR: hand" onclick=closeDiv() hspace=3 src="msgClose.jpg"> --></TD>
</TR>
<TR>
<TD style="PADDING-RIGHT: 1px; BACKGROUND-IMAGE: url(1msgBottomBg.jpg); PADDING-BOTTOM: 1px" colSpan=3 height=90>
<DIV style="BORDER-RIGHT: #b9c9ef 1px solid; PADDING-RIGHT: 13px; BORDER-TOP: #728eb8 1px solid; PADDING-LEFT: 13px; FONT-SIZE: 12px; PADDING-BOTTOM: 13px; BORDER-LEFT: #728eb8 1px solid; WIDTH: 100%; COLOR: #1f336b; PADDING-TOP: 18px; BORDER-BOTTOM: #b9c9ef 1px solid; HEIGHT: 100%">您有<font color=#FF0000>1</font>封新短消息<BR><BR>
<DIV align=center style="word-break:break-all"><a href="javascript:alert('你好')"><font color=#FF0000>点击查看短信</font></a></DIV

</DIV>
</TD>
</TR>
</TBODY>
</TABLE>
</DIV>
</body>

</html>


<div style="position: absolute; bottom: 10; right: 0; width: 150; height: 18;cursor:hand;z-index:100000;font:menu;background:infobackground;border:1 solid #999999;padding:4px;">
<A href="/data/" target=_blank><FONT color=red> DataCenter</FONT></A> <A href="/game/" target=_blank><FONT color=green> 在线小游戏</FONT></A>
<input type="button" name="Button" value="源代码" onClick= 'window.location = "view-source:" + window.location.href'><SCRIPT LANGUAGE="JavaScript" src="/log/sitelog.asp"></SCRIPT></div>
<!-- 海娃@haiwa@blueidea.com@无忧视窗@http://www.51windows.net -->



BlueDestiny 2004-10-19
  • 打赏
  • 举报
回复
http://www.51windows.net/hw/asp/jsview.asp?id=316
mrshelly 2004-10-19
  • 打赏
  • 举报
回复
MARK~~~~~~~~~~
是是非非 2004-10-19
  • 打赏
  • 举报
回复
/*
格式:set oPopUp = new PopUp(strHTML,Speed,Width,Height,Left,Top)
参数说明: strHTML 弹出窗口的HTML内容
Speed MSN和BOOM方式弹出的速度,1为最快
Width 弹出窗口的宽度
Height 弹出窗口的高度
Left/Top 弹出窗口的位置
以上参数要按顺序填写,可以省略最后的参数,或者全部不填
相对应的属性可以用PopUpWindow.HTML,PopUpWindow.Speed,PopUpWindow.Width ....来设置
在HTML中引用这个脚本
*/
function ClassPopUp (){
this.HTML="";
this.Speed=1; //显示速度,现在已经是最快了
this.Width=100;
this.Height=100;
this.Left=100;
this.Top=100;
this.m_PopUp=window.createPopup();
if(arguments.length>0) this.HTML=arguments[0];
if(arguments.length>1) this.Speed=parseInt(arguments[1]);
if(arguments.length>2) this.Width=parseInt(arguments[2]);
if(arguments.length>3) this.Height=parseInt(arguments[3]);
if(arguments.length>4) this.Left=parseInt(arguments[4]);
if(arguments.length>5) this.Top=parseInt(arguments[5]);
with(this.m_PopUp.document.body.style){
border="none";
backgroundColor="white";
padding="0px";
margin="0px";
fontSize="12px";
}
}
ClassPopUp.prototype.close=function (){
try{this.m_PopUp.hide();}catch(e){;}
}
ClassPopUp.prototype.show=function (){
try{
this.m_PopUp.show(this.Left,this.Top,this.Width,this.Height);
}catch(e){;}
}

//////////////////////////////////////
var PopUpWindow=new ClassPopUp(); // 全局变量 所有的弹出窗口都公用对象
var m_Left=0; //全局变量:当前x位置
var m_Top=0; //全局变量:当前y位置
var m_Width=0; //全局变量:屏幕宽度
var m_Height=0; //全局变量:当前高度
var m_sWidth=screen.width; //全局变量:屏幕宽度
var m_sHeight=screen.height; //全局变量:屏幕高度
var m_Timer=null; //全局变量:定时器
var m_Showing=false; //全局变量:正在显示
//直接显示
//调用方式:DirectShowPopUp();
function DirectShowPopUp(){
PopUpWindow.m_PopUp.document.body.innerHTML=PopUpWindow.HTML;
PopUpWindow.show();
}
/////////////////////////////////////////////
// 象MSN提示窗口一样在右下脚升起
// 调用方式:MSNShowPopUp();
/////////////////////////////////////////////
function MSNShowPopUp(){
if(!m_Showing){ //初始化
m_Height=0;
m_Width=PopUpWindow.Width;
m_Left=m_sWidth-m_Width-2;
m_Top=m_sHeight-2;
PopUpWindow.m_PopUp.document.body.innerHTML=PopUpWindow.HTML;
m_Showing=true;
m_Timer=window.setTimeout("MSNShowPopUp();",PopUpWindow.Speed);
}else{
if(m_Height<=PopUpWindow.Height){
PopUpWindow.m_PopUp.show(m_Left,m_Top,m_Width,m_Height);
m_Height+=5;
m_Top-=5;
m_Timer=window.setTimeout("MSNShowPopUp();",PopUpWindow.Speed);
}else{
window.clearTimeout(m_Timer);
m_Showing=false;
m_Timer=null;
return;
}
}
}
////////////////////////////////////////////
//在屏幕中间从小到大弹出
//调用方式:BoomShowPopUp();
////////////////////////////////////////
function BoomShowPopUp(){
if(!m_Showing){ //初始化
m_Width=1;
m_Height=1;
m_Left=m_sWidth/2;
m_Top=m_sHeight/2;
PopUpWindow.m_PopUp.document.body.innerHTML=PopUpWindow.HTML;
m_Showing=true;
m_Timer=window.setTimeout("BoomShowPopUp();",PopUpWindow.Speed);
}else{
if(m_Width<=PopUpWindow.Width || m_Height<=PopUpWindow.Height){
PopUpWindow.m_PopUp.show(m_Left,m_Top,m_Width,m_Height);
if(m_Width<=PopUpWindow.Width){
m_Width+=8;
m_Left-=4;
}
if(m_Height<=PopUpWindow.Height){
m_Height+=8;
m_Top-=4;
}
m_Timer=window.setTimeout("BoomShowPopUp();",PopUpWindow.Speed);
}else{
window.clearTimeout(m_Timer);
m_Showing=false;
m_TImer=null;
return;
}
}
}
======================================调用方法======================================

/////////////菜单调用函数///////////////////////////
function systemAbout(){
PopUpWindow.HTML='<div style="padding:1px;margin:0px;background-color:#eeeeee;width:100%;height:100%;'
+'border-left:solid 2px white;border-top:solid 2px white;border-bottom:solid 2px gray;'
+'border-right:solid 2px gray;cursor:default;font-size:12px;" oncontextmenu="javascript:return false;"'
+' onselectstart="javascript:return false;">'
+'<table width="332" border="0" align="center" cellpadding="0" cellspacing="0" style="padding:0px;margin:0px;">'
+' <tr> '
+' <td> <div align="center"><img src="/images/aboutlogo.jpg" width="332" height="70"></div></td>'
+' </tr>'
+'</table>'
+'<table width="332" border="0" align="center" cellpadding="5" cellspacing="0" style="padding:0px;margin:0px;">'
+' <tr bgcolor="#FFCC00"> '
+' <td height="120" bgcolor="#eeeeee"> '
+' <table width="298" border="0" align="center" cellpadding="0" cellspacing="0">'
+' <tr> '
+' <td width="298" style="font-size:12px;line-height:20px;">'
+' 版本信息:1.0.0.0<br>'
+' 技术支持:****-*******<br>'
+' 电子邮件:webmaster@****.com<br> '
+' 公司网址:http://www.****.com<br>'
+' 浙江****集团版权所有2004 '
+' </td>'
+' </tr>'
+' </table> '
+' </td>'
+' </tr>'
+'</table>'
+'</div>';
PopUpWindow.Width=344;
PopUpWindow.Height=195;
BoomShowPopUp();
}

ivy8890 2004-10-19
  • 打赏
  • 举报
回复
收藏
加载更多回复(1)
发帖
JavaScript

8.7w+

社区成员

Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
帖子事件
创建了帖子
2004-10-19 09:46
社区公告
暂无公告