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

How to style Input type button in html

本文关键字:类型 按钮 样式 输入 设置 html      更新时间:2023-09-26

我有以下代码片段,它插入了一个点击按钮并在我的CRM中打开了一个谷歌页面。如何设置按钮样式。该按钮位于下面的输入选项卡中。什么是反对。到 maka 一个按钮更流畅、更精湛

<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;
}