为什么我在html里面是可以上下滚动的,加到asp.net页面中就不会动了?我把代码贴出来了,大家帮我看下,比较急~~~~~
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>无标题页</title>
<script lang="javascript">
var initTop=0
function init()
{
initTop=document.getElementById("ali").style.pixelTop;
}
function move()
{
document.getElementById("ali").style.pixelTop=initTop+document.body.scrollTop;
}
window.onscroll=move;
</script> </head><body onLoad="init()"><div id="ali"style="position:absolute;left:1100px;top:120px;z-index:1;">
<a target="_blank" href="http://amos.im.alisoft.com/msg.aw?v=2&uid=hylantian&site=cnalichn&s=5" ><img border="0" src="http://amos.im.alisoft.com/online.aw?v=2&uid=hylantian&site=cnalichn&s=5" alt="点击这里给我发消息" />
</a></div>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<form id="form1" runat="server">
</form>
</body>
</html>
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>无标题页</title>
<script lang="javascript">
var initTop=0
function init()
{
initTop=document.getElementById("ali").style.pixelTop;
}
function move()
{
document.getElementById("ali").style.pixelTop=initTop+document.body.scrollTop;
}
window.onscroll=move;
</script> </head><body onLoad="init()"><div id="ali"style="position:absolute;left:1100px;top:120px;z-index:1;">
<a target="_blank" href="http://amos.im.alisoft.com/msg.aw?v=2&uid=hylantian&site=cnalichn&s=5" ><img border="0" src="http://amos.im.alisoft.com/online.aw?v=2&uid=hylantian&site=cnalichn&s=5" alt="点击这里给我发消息" />
</a></div>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<form id="form1" runat="server">
</form>
</body>
</html>
解决方案 »
- 有关网页身份验证,自动转向login页的问题
- 写的上传代码 上传后怎么不包含在项目里?
- 在 Asp.net 中使用HttpModule 和 HttpHandle 的作用?
- 如何获取DataView的指定行数???
- 怎么给xml文档中添加数据
- windows web方式登录 有个新问题 `````````
- js中有没有类似VB里的left关键字或相应的解决办法?
- ActiveX中inet1.execute中post给apsx页面的数据怎么接收
- [求助]类似于<%=BsAddress%>格式的表达式,其值到哪里找?
- formview 问题?
- .NET 有那些好的框架,可供学习?
- 再试试 :这个内容是个什么控件 怎么实现的
function init()
{
initTop= parseInt(document.getElementById("ali").style.top);
}
window.onscroll= function(){
document.getElementById("ali").style.top = (initTop + parseInt(document.documentElement.scrollTop)).toString() + "px";
}
直接导致document.body.scrollTop永远等于0,
所以:用document.documentElement.scrollTop替换document.body.scrollTop就可以了.
已测试成功哦!!!