难道是Firefox本身处理javascript的问题? ###[100分]###
<html>
<head>
<title></title>
<script>
function test()
{
document.write('after click.');
location.hash='123';
}
</script>
</head>
<body>
<div ="test();">click on me!</div>
</body>
</html>
期望的结果是:当点击了"click on me!"后,页面显示结果为"after click.",地址栏多了"#123".
上面的例子代码。在IE上是能很好,得到预期的结果。
但是在FF中却很奇怪。点击了"click on me!"后,页面显示还是"click on me!",地址栏有"#123"。
经调试,发现是FF里,页面执行location.hash='123'后重新加载导致结果不是预期的那样。
但是如果没有write('after click.');的话location.hash='123'是不会导致页面重新加载的。
也就是说write('after click.');会对执行location.hash='123'产生影响。
现在想解决的是,有没有什么办法,能让location.hash不使页面重新加载?
高手帮忙解决!!谢谢了。。
这里还有分!!
http://community.csdn.net/Expert/topic/5104/5104818.xml?temp=.383053
不够+++