类似新浪网的 弹出视频功能实现代码
<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>1300) 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').innerHTML='';
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: 120px; VISIBILITY: hidden; BORDER-LEFT: #a6b4cf 1px solid; WIDTH: 265px; BORDER-BOTTOM: #455690 1px solid; POSITION: absolute; TOP: 100px; HEIGHT: 255px; BACKGROUND-COLOR: #c9d3f3">
<TABLE width="265" border=0 cellPadding=0 cellSpacing=0 bgColor=#AFDCF3 style="BORDER-TOP: #ffffff 1px solid; BORDER-LEFT: #ffffff 1px solid" style="BORDER-TOP: #ffffff 1px solid; BORDER-LEFT: #ffffff 1px solid">
<TR bgColor=#6699cc>
<TD height=24 style="font-size: 12px; background-image: url('msgTopBg.gif'); color: #0f2c8c" style="font-size: 12px; background-image: url('msgTopBg.gif'); color: #0f2c8c">教育的意义</TD>
<TD style="background-image: url('msgTopBg.gif'); padding-right: 2px; padding-top: 2px" style="background-image: url('msgTopBg.gif'); padding-right: 2px; padding-top: 2px" vAlign=center align=right><span title=关闭 style="CURSOR: hand;color:white;font-size:12px;font-weight:bold;margin-right:4px;" style="CURSOR: hand;color:white;font-size:12px;font-weight:bold;margin-right:4px;" onclick=closeDiv() >×</span><!--<IMG title=关闭 style="CURSOR: hand" style="CURSOR: hand" onclick=closeDiv() hspace=3 src="msgClose.jpg" src="msgClose.jpg">--></TD>
</TR>
<TR>
<TD height=225 colSpan=2 align="left" valign="bottom" style="background-image: url('UploadFiles/200510822587734.jpg'); padding-right: 1px; padding-bottom: 1px" style="background-image: url('UploadFiles/200510822587734.jpg'); padding-right: 1px; padding-bottom: 1px"><span 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%">
<object classid="clsid:05589FA1-C356-11CE-BF01-00AA0055595A" width="239" height="215" id="ActiveMovie1">
<param name="Appearance" value="/0" />
<param name="AutoStart" value="-1" />
<!--控制播放方式: x=1,打开网页自动播放; x=0,按播放键播放。-->
<param name="AllowChangeDisplayMode" value="-1" />
<param name="AllowHideDisplay" value="0" />
<param name="AllowHideControls" value="-1" />
<param name="AutoRewind" value="-1" />
<param name="Balance" value="0" />
<param name="CurrentPosition" value="0" />
<param name="DisplayBackColor" value="0" />
<param name="DisplayForeColor" value="16777215" />
<param name="DisplayMode" value="0" />
<param name="Enabled" value="-1" />
<param name="EnableContextMenu" value="-1" />
<param name="EnablePositionControls" value="-1" />
<param name="EnableSelectionControls" value="0" />
<param name="EnableTracker" value="-1" />
<param name="Filename" value="资源链接地址.mpg" valuetype="ref" />
<!--文件路径-->
<param name="FullScreenMode" value="0" />
<param name="MovieWindowSize" value="0" />
<param name="PlayCount" value="0" />
<!--控制重复次数: “x”为几重复播放几次; x=0,无限循环。-->
<param name="Rate" value="1" />
<param name="SelectionStart" value="-1" />
<param name="SelectionEnd" value="-1" />
<param name="ShowControls" value="-1" />
<param name="ShowDisplay" value="0" />
<param name="ShowPositionControls" value="0" />
<param name="ShowTracker" value="-1" />
<param name="Volume" value="-480" />
</object>
</span></TD>
</TR>
</TABLE>
具体的实现代码测试:
我们
1300) 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)
我们 | × |
[Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]
Tags:新浪网 弹出视频
相关文章
- 2009-08-08javascript 定时广告显示(两个时间段)
- 2006-06-06精彩图片推荐 渐隐渐现
- 2009-06-06javascript 强制弹出窗口代码-跨拦截
- 2009-11-11一段时间以后切换显示的广告代码
- 2007-04-04给网站上的广告“加速”显示的方法
- 2010-09-09可关闭与最小化的右下角浮动广告代码
- 2008-09-09js右下角弹出窗口,点击可关闭效果
- 2007-08-08javascript实现的多条新闻公告系统
- 2007-01-01关于图片验证码设计的思考
- 2007-11-11Flash+XML滚动新闻代码 无图片 附源码下载