繁体   English   中英

如何在HTML中设置输入类型按钮的样式

[英]How to style Input type button in html

我有以下代码片段,该片段插入“单击按钮”并在我的CRM中打开一个Google页面。 如何设置按钮样式。 该按钮出现在下面的输入选项卡中。 使按钮更顺滑和精湛

<script>

function openLink(target){

        window.open('https://google.co.in','_blank');
}

function addCustomButton()
{



               var mergeNode = document.getElementById("BTN_TB_AccountForm_MergeWizard").parentNode.parentNode.parentNode.parentNode;

               var parent=mergeNode.parentNode;



               //BTN_TB_AccountForm_MergeWizard is the ID of the Merge Button on the ActionForm Bar


               //Create a TD node and attach a buttom element.

               var td2 = document.createElement("td");
               td2.innerHTML="<input type=button  value=Click onclick=\"openLink()\">";

               //Append Child
               parent.insertBefore(td2,mergeNode.nextSibling);


        }

}

setTimeout ( "addCustomButton()", 1000 ); // To be sure the Action Bar is loaded
</script>

您可以使用以下方式设置样式:

input {
   your css here
}

或者更具体的用途:

input[type=button]

您可以尝试设置按钮的CSS类:

<input type="button" class="MyButton" value="Click" onclick="openLink();">

并设置td内部html像这样:

td2.innerHTML="<input type='button' class='MyButton' value='Click' onclick=\"openLink();\">";

CSS(此样式仅用于演示,您可以设置您的特定要求或根据您的要求):

.MyButton{
   color: #ffffff;
   background-color: #1EAA49;
  *background-color: #1EAA49;
   border-color: #4cae4c;
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM