js调用css属性写法
2013-09-21 11:59
330 查看
1、对于没有中划线的css属性一般直接使用style.属性名即可。
如:obj.style.margin,obj.style.width,obj.style.left,obj.style.position等。
2、对于含有中划线的css属性,将每个中划线去掉并将每个中划线后的第一个字符换成大写即可。
如:obj.style.marginTop,obj.style.borderLeftWidth,obj.style.zIndex,obj.style.fontFamily等。
因为float是Javascript的保留字,那怎么在js中书写样式表中的float呢?
我们不能直接使用obj.style.float来使用,这样操作是无效的。
其正确的使用方法是为:IE:obj.style.styleFloat,其他浏览器Mozilla(gecko),ff等用styleFloat:obj.style.cssFloat。
如:obj.style.margin,obj.style.width,obj.style.left,obj.style.position等。
2、对于含有中划线的css属性,将每个中划线去掉并将每个中划线后的第一个字符换成大写即可。
如:obj.style.marginTop,obj.style.borderLeftWidth,obj.style.zIndex,obj.style.fontFamily等。
因为float是Javascript的保留字,那怎么在js中书写样式表中的float呢?
我们不能直接使用obj.style.float来使用,这样操作是无效的。
其正确的使用方法是为:IE:obj.style.styleFloat,其他浏览器Mozilla(gecko),ff等用styleFloat:obj.style.cssFloat。
相关文章推荐
- js调用css属性写法
- kockout.js的viewmodel对象的属性,在javascript中调用的两种写法
- js动态调用css属性的小规律及实例说明
- js动态调用css属性的小规律及实例说明
- JS不兼容减号,css属性转驼峰写法
- js动态调用css属性的实例说明
- CSS3动画效果——js调用css动画属性并回调处理详解
- 使用js操作css属性的写法
- js调用css属性
- 使用js操作css属性的写法规律
- jsp页面的调用静态资源(如img,css,js)等资源时路径的写法
- js访问CSS的2种方法(点法和中括号法的区别),内含获取属性的兼容写法
- JS操作css的float属性的特殊写法
- JS操作css的float属性的特殊写法
- 使用js操作css属性和css中的写法不同
- js中json对象不规律key的遍历实现和json对象length属性的调用
- javascript下操作css的float属性的特殊写法
- js修改css属性、html属性
- HTML标签onclick属性中调用JS时出现的问题
- js调用css的问题,适应不同浏览器对ID的调用方法