zoukankan      html  css  js  c++  java
  • javascript 反射 样式

     

     

    代码:

     1 <html>
     2 <head>
     3     <title></title>
     4 </head>
     5 <body>
     6     <form id="myForm" >
     7     Hello World~
     8     </form>
     9     <script type="text/javascript">
    10         function evaluateByStyle() {
    11             var element = document.getElementById("myForm");
    12             for (var p in _style) {
    13                 element.style[p] = _style[p];
    14             }
    15         }
    16         var _style = {
    17            color:"#ffffff",
    18            backgroundColor:"#ff0000",
    19            borderWidth:"2px",
    20            fontSize:"50px"
    21         }
    22 
    23         window.load = evaluateByStyle(_style);
    24     </script>
    25 </body>
    26 </html>
    27 


     

    结果:

     

    附件:

     

    JavaScript 支持的CSS 样式 参考表:

     

    accelerator        "false"        String

    background        ""        String

    backgroundAttachment        ""        String

    backgroundColor        ""        String

    backgroundImage        ""        String

    backgroundPosition        ""        String

    backgroundPositionX        ""        String

    backgroundPositionY        ""        String

    backgroundRepeat        ""        String

    behavior        ""        String

    border        ""        String

    borderBottom        ""        String

    borderBottomColor        ""        String

    borderBottomStyle        ""        String

    borderBottomWidth        ""        String

    borderCollapse        ""        String

    borderColor        ""        String

    borderLeft        ""        String

    borderLeftColor        ""        String

    borderLeftStyle        ""        String

    borderLeftWidth        ""        String

    borderRight        ""        String

    borderRightColor        ""        String

    borderRightStyle        ""        String

    borderRightWidth        ""        String

    borderSpacing        ""        String

    borderStyle        ""        String

    borderTop        ""        String

    borderTopColor        ""        String

    borderTopStyle        ""        String

    borderTopWidth        ""        String

    borderWidth        ""        String

    bottom        ""        String

    boxSizing        ""        String

    captionSide        ""        String

    clear        ""        String

    clip        ""        String

    color        ""        String

    constructor        {...}        Object

    content        ""        String

    counterIncrement        ""        String

    counterReset        ""        String

    cssText        ""        String

    cursor        ""        String

    direction        ""        String

    display        ""        String

    emptyCells        ""        String

    filter        ""        String

    font        ""        String

    fontFamily        ""        String

    fontSize        ""        String

    fontStyle        ""        String

    fontVariant        ""        String

    fontWeight        ""        String

    height        ""        String

    imeMode        ""        String

    layoutFlow        ""        String

    layoutGrid        ""        String

    layoutGridChar        ""        String

    layoutGridLine        ""        String

    layoutGridMode        ""        String

    layoutGridType        ""        String

    left        ""        String

    letterSpacing        ""        String

    lineBreak        ""        String

    lineHeight        ""        String

    listStyle        ""        String

    listStyleImage        ""        String

    listStylePosition        ""        String

    listStyleType        ""        String

    margin        ""        String

    marginBottom        ""        String

    marginLeft        ""        String

    marginRight        ""        String

    marginTop        ""        String

    maxHeight        ""        String

    maxWidth        ""        String

    minHeight        ""        String

    minWidth        ""        String

    msBlockProgression        ""        String

    msInterpolationMode        ""        String

    orphans        ""        String

    outline        ""        String

    outlineColor        ""        String

    outlineStyle        ""        String

    outlineWidth        ""        String

    overflow        ""        String

    overflowX        ""        String

    overflowY        ""        String

    padding        ""        String

    paddingBottom        ""        String

    paddingLeft        ""        String

    paddingRight        ""        String

    paddingTop        ""        String

    pageBreakAfter        ""        String

    pageBreakBefore        ""        String

    pageBreakInside        ""        String

    pixelBottom        0        Number

    pixelHeight        0        Number

    pixelLeft        0        Number

    pixelRight        0        Number

    pixelTop        0        Number

    pixelWidth        0        Number

    posBottom        0        Number

    posHeight        0        Number

    position        ""        String

    posLeft        0        Number

    posRight        0        Number

    posTop        0        Number

    posWidth        0        Number

    quotes        ""        String

    right        ""        String

    rubyAlign        ""        String

    rubyOverhang        ""        String

    rubyPosition        ""        String

    scrollbar3dLightColor        ""        String

    scrollbarArrowColor        ""        String

    scrollbarBaseColor        ""        String

    scrollbarDarkShadowColor        ""        String

    scrollbarFaceColor        ""        String

    scrollbarHighlightColor        ""        String

    scrollbarShadowColor        ""        String

    scrollbarTrackColor        ""        String

    styleFloat        ""        String

    tableLayout        ""        String

    textAlign        ""        String

    textAlignLast        ""        String

    textAutospace        ""        String

    textDecoration        ""        String

    textDecorationBlink        false        Boolean

    textDecorationLineThrough        false        Boolean

    textDecorationNone        false        Boolean

    textDecorationOverline        false        Boolean

    textDecorationUnderline        false        Boolean

    textIndent        ""        String

    textJustify        ""        String

    textJustifyTrim        ""        String

    textKashida        ""        String

    textKashidaSpace        ""        String

    textOverflow        ""        String

    textTransform        ""        String

    textUnderlinePosition        ""        String

    top        ""        String

    unicodeBidi        ""        String

    verticalAlign        ""        String

    visibility        ""        String

    whiteSpace        ""        String

    widows        ""        String

    width        ""        String

    wordBreak        ""        String

    wordSpacing        ""        String

    wordWrap        ""        String

    writingMode        ""        String

    zIndex        0        Number

    zoom        ""        String

  • 相关阅读:
    Cs231n课堂内容记录-Lecture1 导论
    Linux实时查询GPU使用命令
    导出excel的简单方法
    正则表达式的一些应用
    4、Python语法之变量
    javaScript中对typeof 和 instanceof 的使用及理解
    JavaScrpt 变量作用域
    真香的flex弹性布局
    css调试与样式优先级
    css3新样式
  • 原文地址:https://www.cnblogs.com/haoliansheng/p/1781994.html
Copyright © 2011-2022 走看看