当我在.aspx页面中使用代码window.location.href =“#”时,在Internet Explorer中没有正确滚动 [英] when iam using the code window.location.href = “#” in .aspx page then scrolling in is not happening properly in internet explorer

查看:166
本文介绍了当我在.aspx页面中使用代码window.location.href =“#”时,在Internet Explorer中没有正确滚动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的asp.net网站中,我想禁用一个内容页面的后退按钮。所以,我在内容页面中使用了以下java脚本代码



函数changeHashOnLoad(){

window.location.href + =# ;

setTimeout(changeHashAgain(),50);

}

函数changeHashAgain(){

window.location.href + =1;

}

var storedHash = window.location.hash;

window.setInterval(function(){

if(window.location.hash!= storedHash){

window.location.hash = storedHash;

}

},50);

changeHashOnLoad ();

以上代码在chrome和mozilla firefox中正常工作,但在Internet Explorer中,页面无法正确滚动。任何人请给出解决方案。



谢谢。

In my asp.net website i want to disable the back button for one content page. so, i used the below java script code in content page

function changeHashOnLoad() {
window.location.href += "#";
setTimeout("changeHashAgain()", "50");
}
function changeHashAgain() {
window.location.href += "1";
}
var storedHash = window.location.hash;
window.setInterval(function () {
if (window.location.hash != storedHash) {
window.location.hash = storedHash;
}
}, 50);
changeHashOnLoad();
The above code is working correctly in chrome and mozilla firefox, but in internet explorer the page doesnot scrolling properly. Anybody please give the solution.

Thank you.

推荐答案

感谢所有我得到的ans

i刚刚像这样重新加载页面

ScriptManager.RegisterStartupScript(this,typeof(Page),alert,< script type ='text / javascript'> ; window.location.reload()< / script>,false);
thanks to all i have got the ans
i have just reload the page like this
ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "<script type='text/javascript'>window.location.reload()</script>", false);


这篇关于当我在.aspx页面中使用代码window.location.href =“#”时,在Internet Explorer中没有正确滚动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆