目前在IE9下遇到一个比较奇怪的问题,通过JQuery获取css样式中定义的table的margin值无法取得,无论设置什么值,取得的都是0px。
1. JQuery我已经升级到最新的1.5.2,但是和最初始使用的1.3是完全一样的问题。
2. 如果我将table改成div,也就是说定义div的margin再使用$("#dv").css("padding-bottom")可以正确取得值。请教各位大侠这是什么问题?有遇到类似问题的同学吗?谢谢各位。我上传有附件或者见下面的代码片段:
<!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" xml:lang="en" lang="en">
<head>
<style>#dv {
padding-bottom:10px;
width : 600px;
}
</style>
<script src="jquery-1.5.2rc1.js" type="text/javascript"></script>
<script>
function popup()
{
window.open('popup.htm', '', 'left=100,top=100,height=600,width=800')
}function GetMargin()
{
var paddingBottomCss = $("#dv").css("padding-bottom");
var width = $("#dv").css("width");
alert(paddingBottomCss); // width能正确取到
//table申明换成div就能正常工作。
}</script>
</head><body><input type = 'button' value='click' onclick='GetMargin()'><table id="dv"></table></body></html>
1. JQuery我已经升级到最新的1.5.2,但是和最初始使用的1.3是完全一样的问题。
2. 如果我将table改成div,也就是说定义div的margin再使用$("#dv").css("padding-bottom")可以正确取得值。请教各位大侠这是什么问题?有遇到类似问题的同学吗?谢谢各位。我上传有附件或者见下面的代码片段:
<!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" xml:lang="en" lang="en">
<head>
<style>#dv {
padding-bottom:10px;
width : 600px;
}
</style>
<script src="jquery-1.5.2rc1.js" type="text/javascript"></script>
<script>
function popup()
{
window.open('popup.htm', '', 'left=100,top=100,height=600,width=800')
}function GetMargin()
{
var paddingBottomCss = $("#dv").css("padding-bottom");
var width = $("#dv").css("width");
alert(paddingBottomCss); // width能正确取到
//table申明换成div就能正常工作。
}</script>
</head><body><input type = 'button' value='click' onclick='GetMargin()'><table id="dv"></table></body></html>
解决方案 »
- Ext Desktop无法触发事件
- 将按钮控制的左右滚动,改为上下滚动。
- 求救js问题
- JS如何实现两个曾的碰撞检测
- 要实现一个效果,点击按钮,当前页面横向切换成另一个页面。。。
- A script on this page is causing Internet Explorer to run slowly. If it continues to run, your computer may become unresponsive.
- 谁有交换图片的源代码?
- 请问如何实现对一个字符串数组拼音顺序排列
- javascript的表单提交问题?
- JavaScript上style.left的问题
- JS脚本问题...
- 如何用JS解析XML文档?如何取得Name和value的值?哪位高手知道请告诉我,急用!!!
padding-bottom:10px;
width : 600px;
}
的写到TABLE里可否
比如:<table style="padding-bottom:10px;width:600px;">