原贴在:http://topic.csdn.net/u/20100205/16/057b7012-9ea1-48b9-82ef-af80ad75e3cb.html?seed=252443860&r=63304705#r_63304705ASP.NET AJAX 页面上,按住鼠标滚轮,到其刷新时100%会整页刷新。如果在按住后有上移下移,虽不整页刷新但也不局部刷新。如何解决?
vs2005+.net2.0+ ajax Extensions(system.web.extensions), 浏览器ie6、ie6sp1、ie7、ie8、360。概率100%。 全部代码如下:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="t2.aspx.cs" Inherits="t2" %> <!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 type="text/javascript">status+='5seconds'; </script>
</head>
<body onload="setInterval('document.getElementById(\'Button1\').click();',5000);">
<form id="form1" runat="server">
<div>
<br />
<img src="abc.jpg" height="500px" width="1200px" alt="让滚轮出现" /> <br />
<br />
<asp:Label ID="Label1" runat="server" Text="Label"> </asp:Label> <!--Page_Load() {Label1.Text = DateTime.Now.ToString()+"整页刷新";}-->
<hr />
<asp:scriptmanager ID="Scriptmanager1" runat="server"> </asp:scriptmanager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Button ID="Button1" runat="server" Text="Button1" OnClick="Button1_Click" />
<asp:Label ID="Label2" runat="server" Text="Label"> </asp:Label> <!--Button1_Click(){Label2.Text = DateTime.Now.ToString()+"局部刷新";}-->
</ContentTemplate>
</asp:UpdatePanel>
<br />
<img src="abc.jpg" height="500px" width="1200px" alt="让滚轮出现" /> <br />
</div>
</form>
</body>
</html>
vs2005+.net2.0+ ajax Extensions(system.web.extensions), 浏览器ie6、ie6sp1、ie7、ie8、360。概率100%。 全部代码如下:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="t2.aspx.cs" Inherits="t2" %> <!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 type="text/javascript">status+='5seconds'; </script>
</head>
<body onload="setInterval('document.getElementById(\'Button1\').click();',5000);">
<form id="form1" runat="server">
<div>
<br />
<img src="abc.jpg" height="500px" width="1200px" alt="让滚轮出现" /> <br />
<br />
<asp:Label ID="Label1" runat="server" Text="Label"> </asp:Label> <!--Page_Load() {Label1.Text = DateTime.Now.ToString()+"整页刷新";}-->
<hr />
<asp:scriptmanager ID="Scriptmanager1" runat="server"> </asp:scriptmanager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Button ID="Button1" runat="server" Text="Button1" OnClick="Button1_Click" />
<asp:Label ID="Label2" runat="server" Text="Label"> </asp:Label> <!--Button1_Click(){Label2.Text = DateTime.Now.ToString()+"局部刷新";}-->
</ContentTemplate>
</asp:UpdatePanel>
<br />
<img src="abc.jpg" height="500px" width="1200px" alt="让滚轮出现" /> <br />
</div>
</form>
</body>
</html>
解决方案 »
- 为什么要检查未分配值的输出参数,将其分配以DBNull.Value
- 关于调用dll中图片的问题
- 请问,在iframe中用treeview如何实现点击某节点后不刷新 而在另一个iframe中打开点击要打开的页面
- 如何在NHibernate中实现批量处理数据 插入 删除
- 请高手给个以下问题的解决方案,谢谢
- VS2005做的项目部署到目标计算机上了,IIS上有我的所有源代码ASPX/C#/*.TEXT等所有源文件,怎样隐藏我的源代码C#/*.TEXT
- aspx中datalist中插入的button,textbox等控件在aspx.cs中引用问题
- 用最简单函数或者语句判断一个值是否在一个表中的某列中----在线等,马上给分
- 狠狠给分-->如何制作TREEVIEW?
- 我用 ashx 为什么接收不到微信发过来的post数据?
- MD5与SHA1加密解密求教!
- 一个关于FileUpload控件上传图片的问题,求解答~
晕!你这个代码都不对。应该是保持
<body>
</body>然后,再放一个asp.net ajax 的Timer控件,设置Timer的属性来刷新。
回3楼。的确是鼠标滚轮键。
如果不按,跑到电脑待机都没事。
我呢,有一个小程序要运行在浏览器中,局部刷新的,并且使用者可以调整其运行的刷新速度、筛选条件等。没有做成applet,而是js程序,也就是“飞地”一般的跑在浏览器中了。
这个js程序需要数据,需要提交更改的参数,我图方便和兼容,在updatepanel中用了asp.net的Button1,再写Button1_Click,这不就省下很多手写js代码了嘛。然后在页面上用js去“按”它,document.getElementById('Button1').click(),达到目的。似乎就可以达到目的了,但是不行,机器换了6个,原因我也找到了,有两个,
一个,js定时遇到“鼠标滚轮键”就出问题了!“按住”是指按住后鼠标变成上下左右的箭头。按住没关系,按住后有过移动时js定时就暂停。
二个,document.getElementById('cotrolid').eventname(),如果操作的是asp.net的控件(Button、LinkButton、select),那就要注意了,如果此时刻鼠标正在按别的东西,正在框选文字,滚轮键正在“按住”,就会出现整页刷新,或者是“对象不支持此属性或方法scriptresource.axd”几万行有错。
用document.getElementById('Button1').click()的确是不好的,它直接把界面焦点搞掉了。就是不知道怎么可以利用Button1_Click里面的便捷功能,又不需document.getElementById('Button1').click()。
没办法和js程序交流?用滚轮的时候还是要暂停?
谢谢各位。