该代码实现右下角窗口的功能,IE下没有问题,但在FF下就不行了,请问怎么解决呢?<html>
<head>
<script language="JavaScript" type="text/javascript">
function $(obj){
return document.getElementById(obj);
}
function pop(obj){
var h = parseInt($("popDiv").currentStyle.height);
$("popDiv").style.height = (h + obj) + "px";
if(parseInt($("popDiv").style.height) < 2){
window.clearInterval(timer);
$("popDiv").style.display = "none";
}
if(parseInt($("popDiv").style.height) >= 200){
window.clearInterval(timer);
}
}
var timer;
function runtimer(obj){
timer = window.setInterval(function(){pop(obj)},10);
}
window.onload = function(){
runtimer(2);
}
</script></head><body >
<div style="position:absolute;right:0;bottom:0;height:0px;width:200px;border:1px solid red;" id="popDiv">
<a href="javascript:runtimer(-2);">×</a>
</div></body>
</html>
<head>
<script language="JavaScript" type="text/javascript">
function $(obj){
return document.getElementById(obj);
}
function pop(obj){
var h = parseInt($("popDiv").currentStyle.height);
$("popDiv").style.height = (h + obj) + "px";
if(parseInt($("popDiv").style.height) < 2){
window.clearInterval(timer);
$("popDiv").style.display = "none";
}
if(parseInt($("popDiv").style.height) >= 200){
window.clearInterval(timer);
}
}
var timer;
function runtimer(obj){
timer = window.setInterval(function(){pop(obj)},10);
}
window.onload = function(){
runtimer(2);
}
</script></head><body >
<div style="position:absolute;right:0;bottom:0;height:0px;width:200px;border:1px solid red;" id="popDiv">
<a href="javascript:runtimer(-2);">×</a>
</div></body>
</html>
解决方案 »
- 如何做出用户滚动到页面底端时,就增加内容显示在底端?内有样例网址?
- 调用IE查找 报错
- 能分析一下这个图片滚动的效果么!!
- 任何所处位置的脚本语言都默认使用JS来执行。 如果非要使用VBS,用“vbscript:”来指定语言脚本 ------有这种说法吗?
- Firefox 有没有支持 contentEditable 的标签?(有答案+50分结帐)
- 这个函数怎么写
- 如果使用户只能输入大写字母和数字?
- 如何设置一个CHECKBOX的颜色与它被DISABLED时的一样?
- 如何取回ActiveX事件的返回值
- jquery,js获取列总宽度减去所有td列加起来的宽,求剩余
- 虽有在CSS中定义div标签的WIDTH样式,为什么用js取不出来相应的值??
- [分享]Javascript汉字截取和input标签汉字限制长度
return element.currentStyle || document.defaultView.getComputedStyle(element, null);
}var h = parseInt($("popDiv").currentStyle.height);
// --->>>
var h = parseInt(currentStyle($("popDiv")).height);
改成
$("#popDiv").currentStyle
===>
var h = parseInt($("popDiv").style.height);
$("popDiv").style.height;//这个是什么?js还是jqueryjs是这样写的document.getElementById("popDiv").style.heightjquery 是这样的$("#popDiv").height();