您现在的位置:主页 > CSS2.0教程 > 文章内容

CSS属性与JavaScript 编码方法对照表

作者:admin     来源:未知     日期:2012-01-26    点击:0
  CSS与JS紧密配合,为我们的页面增添了很多别致的效果。在中也有相关的案例。为了达到某种特殊的效果我们需要用Javascript动态的去更改某一个标签的CSS属性。比如:鼠标经过一个图片时我们让图片加一个边框,代码可能是这样:JavaScript中style后面的属性应该是什么?

div css xhtml xml Example Source Code Example Source Code [www.]<script type="text/javascript">    
    function imageOver(e) {    
        e.style.border="1px solid red";    
    }    
    function imageOut(e) {    
        e.style.borderWidth=0;    
    }    
</script>    
div css xhtml xml Example Source Code Example Source Code [www.]<img src="52css.png" onmouseover="imageOver(this)" onmouseout="imageOut(this)" />   
JavaScript CSS Style属性对照表

盒子标签和属性对照

div css xhtml xml Example Source Code Example Source Code [www.]CSS语法 (不区分大小写)   JavaScript语法 (区分大小写) 
border   border 
border-bottom   borderBottom 
border-bottom-color   borderBottomColor 
border-bottom-style   borderBottomStyle 
border-bottom-width   borderBottomWidth 
border-color   borderColor 
border-left   borderLeft 
border-left-color   borderLeftColor 
border-left-style   borderLeftStyle 
border-left-width   borderLeftWidth 
border-right   borderRight 
border-right-color   borderRightColor 
border-right-style   borderRightStyle 
border-right-width   borderRightWidth 
border-style   borderStyle 
border-top   borderTop 
border-top-color   borderTopColor 
border-top-style   borderTopStyle 
border-top-width   borderTopWidth 
border-width   borderWidth 
clear   clear 
float   floatStyle 
margin   margin 
margin-bottom   marginBottom 
margin-left   marginLeft 
margin-right   marginRight 
margin-top   marginTop 
padding   padding 
padding-bottom   paddingBottom 
padding-left   paddingLeft 
padding-right   paddingRight 
padding-top   paddingTop 
   用户名: (新注册)  密码: 匿名评论 [所有评论]     注意:(评论内容不能超过250字,需审核后才会公布,可以匿名评论,请自觉遵守互联网相关政策法规。)

精彩广告

    精彩推荐


      Copyright © 2011-2013 CSS教程网 版权所有