请教高手:ASP.NET如何制作一个浮动的层,无论是缩放窗口还是拉动滚动条,这个层总是在左边中间位置? 在ASP.NET如何制作一个浮动的层,无论是缩放窗口还是拉动滚动条,这个层总是在左边中间位置?且,这个层还是可以在里面操作的,比如添加内容,修改内容 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 一个关键的就是删除:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> 这个声明 然后再在页面中运用调用JavaScript文件。这类浮动广告特效很多,一般应用在htm或者asp页面中,因为标准不同,所以不删除上面那个声明的话就不起作用。以下代码通过测试(网上找的浮动对联广告代码,两个对联被我合并在一起了):----------------------------------------------------------------------------第一个是scrolljs.js 文件 代码如下: self.onError=null; currentX = currentY = 0; whichIt = null; lastScrollX = 0; lastScrollY = 0; NS = (document.layers) ? 1 : 0; IE = (document.all) ? 1: 0; var tmp1= tmp2= tmp3 =0; tmp1 = document.body.clientHeight; var isArrayRightBanner = false; var has2ndScraper = false; if (typeof(duilian02.length) == "number") isArrayRightBanner = true; if (typeof(duilian01) == "object") has2ndScraper = true; function makewing() { tmp2 = document.body.clientHeight; if(tmp1 != tmp2){ tmp3 = tmp2 - tmp1; tmp1 = tmp2; if(tmp3<0){} } if(IE) { diffY = document.body.scrollTop; diffX = 0; } else if(NS) { diffY = self.pageYOffset; diffX = self.pageXOffset; } if(diffY != lastScrollY) { percent = .1 * (diffY - lastScrollY); if(percent > 0) percent = Math.ceil(percent); else percent = Math.floor(percent); if(IE) { if (isArrayRightBanner) { if (document.all.skyflash != null) { document.all.skyflash.style.pixelTop += percent; } document.all.duilian02[0].style.pixelTop += percent; document.all.duilian02[1].style.pixelTop += percent; } else { if (document.all.skyflash != null) { document.all.skyflash.style.pixelTop += percent; } document.all.duilian02.style.pixelTop += percent; } if (has2ndScraper) document.all.duilian01.style.pixelTop += percent; } else if(NS) { if (isArrayRightBanner) { document.skyflash.top += percent; document.duilian02[0].top += percent; document.duilian02[1].top += percent; } else { document.skyflash.top += percent; document.duilian02.top += percent; } if (has2ndScraper) document.duilian01.top += percent; } lastScrollY = lastScrollY + percent; } if(diffX != lastScrollX) { percent = .1 * (diffX - lastScrollX); if(percent > 0) percent = Math.ceil(percent); else percent = Math.floor(percent); if(IE) { if (isArrayRightBanner) { if (document.all.skyflash != null) { document.all.skyflash.style.pixelLeft += percent; } document.all.duilian02[0].style.pixelLeft += percent; document.all.duilian02[1].style.pixelLeft += percent; } else { if (document.all.skyflash != null) { document.all.skyflash.style.pixelLeft += percent; } document.all.duilian02.style.pixelLeft += percent; } if (has2ndScraper) document.all.duilian01.style.pixelLeft += percent; } else if(NS) { if (isArrayRightBanner) { document.skyflasy.top += percent; document.duilian02[0].top += percent; document.duilian02[1].top += percent; } else { document.skyflash.top += percent; document.duilian02.top += percent; } if (has2ndScraper) document.duilian01.top += percent; } lastScrollY = lastScrollY + percent; } } if(NS || IE) action = window.setInterval("makewing()",1);--------------------------------------------------------------------------一个就是.aspx页面:<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %><html xmlns="http://www.w3.org/1999/xhtml" ><head runat="server"> <title>无标题页</title> </head><body><div id=duilian01 style="POSITION: absolute; TOP: 100px; HEIGHT: 150px; background-color: #069; width: 100px; left: 6px;"></div><div id=duilian02 style="POSITION: absolute; TOP: 100px; HEIGHT: 150px; background-color: #069; width: 100px; left: 896px;"></div><script language=JavaScript src="scrolljs.js" type=text/javascript></script> <form id="form1" runat="server"><table width="778" height="1000" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#f4f4f4"> <tr> <td></td> </tr></table> </form></body></html> SQL的存储过程 习惯写法? ASP.NET的运行机制问题 ???!!!关于自定义控件自定义属性的又一个古怪的问题!!!??? DataGrid显示中对某列的值进行相加,在其下面显示 问一个调用COM+组件的问题,希望下虾们指点下,谢谢 如何设定打开的IE的标题 求助:动态生成的DataGrid,现在要添加“增删改”功能 VS2005如何打开一个网站 这样的asp.net管理系统需要怎么养的硬件配置? 哪里有treeview下载呀 我这样上传图片,为什么不支持.gif图片呢? 关于updatepanel 如何超动态更新label的值,急
然后再在页面中运用调用JavaScript文件。这类浮动广告特效很多,一般应用在htm或者asp页面中,因为标准不同,所以不删除上面那个声明的话就不起作用。
以下代码通过测试(网上找的浮动对联广告代码,两个对联被我合并在一起了):
----------------------------------------------------------------------------
第一个是scrolljs.js 文件 代码如下: self.onError=null;
currentX = currentY = 0;
whichIt = null;
lastScrollX = 0; lastScrollY = 0;
NS = (document.layers) ? 1 : 0;
IE = (document.all) ? 1: 0; var tmp1= tmp2= tmp3 =0;
tmp1 = document.body.clientHeight; var isArrayRightBanner = false;
var has2ndScraper = false;
if (typeof(duilian02.length) == "number") isArrayRightBanner = true;
if (typeof(duilian01) == "object") has2ndScraper = true; function makewing()
{
tmp2 = document.body.clientHeight;
if(tmp1 != tmp2){
tmp3 = tmp2 - tmp1;
tmp1 = tmp2;
if(tmp3<0){}
}
if(IE)
{
diffY = document.body.scrollTop;
diffX = 0;
}
else if(NS)
{
diffY = self.pageYOffset;
diffX = self.pageXOffset;
} if(diffY != lastScrollY)
{
percent = .1 * (diffY - lastScrollY); if(percent > 0)
percent = Math.ceil(percent);
else
percent = Math.floor(percent); if(IE)
{
if (isArrayRightBanner)
{
if (document.all.skyflash != null) {
document.all.skyflash.style.pixelTop += percent;
}
document.all.duilian02[0].style.pixelTop += percent;
document.all.duilian02[1].style.pixelTop += percent;
}
else
{
if (document.all.skyflash != null) {
document.all.skyflash.style.pixelTop += percent;
}
document.all.duilian02.style.pixelTop += percent;
}
if (has2ndScraper) document.all.duilian01.style.pixelTop += percent;
}
else if(NS)
{
if (isArrayRightBanner)
{
document.skyflash.top += percent;
document.duilian02[0].top += percent;
document.duilian02[1].top += percent;
}
else
{
document.skyflash.top += percent;
document.duilian02.top += percent;
}
if (has2ndScraper) document.duilian01.top += percent;
} lastScrollY = lastScrollY + percent;
} if(diffX != lastScrollX)
{
percent = .1 * (diffX - lastScrollX); if(percent > 0)
percent = Math.ceil(percent);
else
percent = Math.floor(percent); if(IE)
{
if (isArrayRightBanner)
{
if (document.all.skyflash != null) {
document.all.skyflash.style.pixelLeft += percent;
}
document.all.duilian02[0].style.pixelLeft += percent;
document.all.duilian02[1].style.pixelLeft += percent;
}
else
{
if (document.all.skyflash != null) {
document.all.skyflash.style.pixelLeft += percent;
}
document.all.duilian02.style.pixelLeft += percent;
}
if (has2ndScraper) document.all.duilian01.style.pixelLeft += percent;
}
else if(NS)
{
if (isArrayRightBanner)
{
document.skyflasy.top += percent;
document.duilian02[0].top += percent;
document.duilian02[1].top += percent;
}
else
{
document.skyflash.top += percent;
document.duilian02.top += percent;
}
if (has2ndScraper) document.duilian01.top += percent;
}
lastScrollY = lastScrollY + percent;
}
}
if(NS || IE) action = window.setInterval("makewing()",1);
--------------------------------------------------------------------------
一个就是.aspx页面:<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>无标题页</title>
</head>
<body><div id=duilian01 style="POSITION: absolute; TOP: 100px; HEIGHT: 150px; background-color: #069; width: 100px; left: 6px;"></div>
<div id=duilian02 style="POSITION: absolute; TOP: 100px; HEIGHT: 150px; background-color: #069; width: 100px; left: 896px;"></div>
<script language=JavaScript src="scrolljs.js" type=text/javascript></script>
<form id="form1" runat="server"><table width="778" height="1000" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#f4f4f4">
<tr>
<td></td>
</tr>
</table>
</form>
</body>
</html>