html [ArasLabs / custom-form-css]显示custom_icon表单字段的内容

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了html [ArasLabs / custom-form-css]显示custom_icon表单字段的内容相关的知识,希望对你有一定的参考价值。

<img id="myIcon" name="myIcon" src="../customer/svg/package.svg" vspace="20" hspace="20" />

<script>
  chooseIcon = function()
  {
    var icn = "../customer/svg/";
    
    // get classification, gets "none" if getProperty returns null 
    var thisItem = document.thisItem;
    var classification = thisItem.getProperty("classification","none");
    
    // get icon fields
    var defIcon = document.getElementById("large_icon_img");
    var myIcon = document.getElementById("myIcon");
    
    // choose file name
    switch (classification)
    {
      case "none":
        // choose part icon file
        icn = defIcon.getAttribute("src");
        break;

      case "Assembly":
        icn += "package.svg";
        break;

      case "Component":
        icn += "circuit-board.svg";
        break;

      case "Material":
        icn += "beaker.svg";
        break;

      case "Software":
        icn += "file-binary.svg";
        break;
    }
    
    // style custom icon
    myIcon.setAttribute("src",icn);
    myIcon.style.visibility = "visible";
    myIcon.style.display = "block";
    
    // hide default icon element
    defIcon.style.visibility = "hidden";
  }

  // choose icon onLoad
  window.addEventListener("load", chooseIcon);
</script>

以上是关于html [ArasLabs / custom-form-css]显示custom_icon表单字段的内容的主要内容,如果未能解决你的问题,请参考以下文章

css [ArasLabs / custom-form-css]定义字段集的样式

css [ArasLabs / custom-form-css]导入表单的自定义CSS文件

csharp [ArasLabs / override-default-structure-browser]显示零件,文档和CAD的分类属性

css [ArasLabs / custom-form-css]用于自定义item_info字段内容的CSS

css 来自myStyles.css的[ArasLabs / custom-form-css]片段,显示应用于myIcon的样式

csharp [ArasLabs / override-default-structure-browser]将分类属性添加到与上下文项相同类型的项中