漂浮div窗体,带停止
js代码
<SCRIPT language="JavaScript">
<!-- Begin
var xPos = 20;
var yPos = 0;
var step = 1;
var delay = 30;
var height = 0;
var Hoffset = 0;
var Woffset = 0;
var yon = 0;
var xon = 0;
var pause = true;
var interval;
floatDiv.style.top = yPos;
function changePos()
{
width = document.body.clientWidth;
height = document.body.clientHeight;
Hoffset = floatDiv.offsetHeight;
Woffset = floatDiv.offsetWidth;
floatDiv.style.left = xPos + document.body.scrollLeft;
floatDiv.style.top = yPos + document.body.scrollTop;
if (yon)
{
yPos = yPos + step;
}
else
{
yPos = yPos - step;
}
if (yPos < 0)
{
yon = 1;
yPos = 0;
}
if (yPos >= (height - Hoffset))
{
yon = 0;
yPos = (height - Hoffset);
}
if (xon)
{
xPos = xPos + step;
}
else
{
xPos = xPos - step;
}
if (xPos < 0)
{
xon = 1;
xPos = 0;
}
if (xPos >= (width - Woffset))
{
xon = 0;
xPos = (width - Woffset);
}
}
function start()
{
floatDiv.visibility = "visible";
interval = setInterval('changePos()', delay);
}
function stops()
{
clearInterval(interval);
}
start();
// End -->
</SCRIPT>
body代码:
<div class="table" id="floatDiv" onMouseOut="start();" onMouseOver="stops();" style="Z-INDEX: 1;LEFT: 0px;BACKGROUND-IMAGE: url(images/default/bobybg.gif);WIDTH: 180px;POSITION: absolute;TOP: 0px;HEIGHT: 60px"
runat="server">
<table id="Table1" cellSpacing="7" cellPadding="0" width="100%" border="0" runat="server">
<tr>
<td style="WORD-BREAK: break-all"><asp:DataList id="rptBulletinFloat" Runat="server">
<ItemTemplate>
<TABLE width="98%" align="center" border="0" cellPadding="3" cellSpacing="0">
<tr>
<td valign="top" width="10">
<img src="images/Default/bulletin_icon.gif" align="absMiddle" height="12" width="10">
</td>
<td align="left">
<a style="COLOR:#8E236B" target="_blank" href='InformationRelease/Information/InformationView.aspx?informationId=<%# DataBinder.Eval(Container, "DataItem.Id") %>' onclick="OpenFullWindow(this.href);return false;">
<%# Convert.ToString(DataBinder.Eval(Container.DataItem, "title")).Length> 20 ? Convert.ToString(DataBinder.Eval(Container.DataItem,"title")).Substring(0, 20)+"..." : DataBinder.Eval(Container.DataItem, "title")%>
; </a>
</td>
</tr>
</TABLE>
</ItemTemplate>
</asp:DataList></td>
</tr>
<tr>
<td align="right"><a onclick="funClose();" style="CURSOR:hand;color:blue">关闭</a> <input id="txtIsNull" style="DISPLAY: none" type="text" name="txtIsNull" runat="server">
</td>
</tr>
</table>
</div>