这段代码哪里出现问题了,为什么提示JS参数无效 swftm这个函数是用来透明flash的 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 我的那一段代码的原意是:先用ID号为sernemu的层展现出部分flash内容当鼠标动作时,展开和收缩ID号为sernemu的层来完全和部分展示出flash内容 <div id="sernemu" name="sernemu" onmouseover="mover();" onmouseout="mout();">你设置div的高度了吗?自己执行一下这个代码看输出什么alert(parseFloat(document.getElementById("sernemu").style.height)); alert(parseFloat(document.getElementById("sernemu").style.height)); 运行后出现的结果是"NaN"我在CSS样式中有定义sernemu的高度#sernemu { width:528px; height:189px; overflow: hidden; } 错误的原因:ss.height得到空字符串parseFloat为NaN加“px”之后为NaNpx,所以赋给style.height会有错误。分析:document.getElementById("sernemu").style 指div的inline的style你的div的height属性是在css中设置的,所以ss.height会得到""(空字符串)有两个解决方案:1.将currentStyle(FF中为computedStyle)中的height赋给ss.heightss.height = document.getElementById("sernemu").currentStyle.height;2.如果你是要取实际高度,可以考虑使用offsetHeight 但是我这一块要动态的改变sernemu层的高度值怎么把值传回给sernemu的样式如果值不能回传应用的话,sernemu层展开收缩的效果就不能实现了 不需要回传直接设置给ss.height就可以了inline属性会覆盖css中的属性试试看:-) js点击切换样式 问一个插件名,不知道大家有用过吗? 用javascript读取xml文件内容,在HTML文件中显示 jquery “或者”怎么表达? 如何判断两个函数是否相等? AJAX的XMLHttpRequest对象使用POST方法传递数据的编码方式如何更改为GB2312?? 如何根据下拉框的选值动态生成几个文本框 问一个愚蠢的问题,关于getelementbyid 光标焦点判定的问题,谢谢! 如何打印iframe里的东西;如何控制iframe里的form提交 请教关于正则表达式 Firefox下超链接中事件无法触发?
先用ID号为sernemu的层展现出部分flash内容
当鼠标动作时,展开和收缩ID号为sernemu的层来完全和部分展示出flash内容
你设置div的高度了吗?自己执行一下这个代码看输出什么
alert(parseFloat(document.getElementById("sernemu").style.height));
#sernemu {
width:528px;
height:189px;
overflow: hidden;
}
ss.height得到空字符串
parseFloat为NaN
加“px”之后为NaNpx,所以赋给style.height会有错误。
分析:
document.getElementById("sernemu").style 指div的inline的style
你的div的height属性是在css中设置的,所以ss.height会得到""(空字符串)
有两个解决方案:
1.将currentStyle(FF中为computedStyle)中的height赋给ss.height
ss.height = document.getElementById("sernemu").currentStyle.height;
2.如果你是要取实际高度,可以考虑使用offsetHeight
直接设置给ss.height就可以了
inline属性会覆盖css中的属性
试试看:-)