• 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

  • 相关阅读:
    通过身份证号获取性别
    网线的制作方法
    duilib中的V和H布局中滚动条问题
    duilib中控件拖拽功能的实现方法(附源码)
    仿酷狗音乐播放器已开源!
    关于仿酷狗音乐播放器开源:寻求一套音乐播放器素材,让仿酷狗开源
    Richedit使用大全
    Redrain个人维护并使用的DuiLib和UiLib库源码下载地址
    vc编译器 msvcr.dll、msvcp.dll的含义和相关错误的处理
    duilib List控件,横向滚动时列表项不移动或者移动错位的bug的修复
  • 原文地址:https://www.cnblogs.com/haoliansheng/p/1781994.html
Copyright © 2020-2023  润新知