Home  >  Article  >  Web Front-end  >  How to change the wording of html submit button

How to change the wording of html submit button

藏色散人
藏色散人Original
2021-03-26 11:08:005341browse

How to change the wording of the html submit button: 1. Directly modify the value attribute, with code such as "onclick="getPasswd()" value="display "..."; 2. Modify the innerHTML of the button, with code such as "type="button" onclick...".

How to change the wording of html submit button

The operating environment of this article: Windows 7 system, HTML5 version, Dell G3 computer.

Modify the text displayed by button in html

1. 8e03557d3950bf880a2e4583affa2fab Implement password input box Visible and hidden

##You can directly modify the value attribute

<script type="text/javascript">
function getPasswd(){    
var passwd = document.getElementById("pwdID");    
var pwdBtn = document.getElementById("pwdBtnID");    
if(passwd.type=="password")    {
        passwd.type="text";
        pwdBtn.value="隐藏";
    }    else{
        passwd.type="password";
        pwdBtn.value="显示";
    }
}</script>
密码:<input id="pwdID" type="password"><input id="pwdBtnID" type="button" onclick="getPasswd()" value="显示">

2. bb9345e55eb71822850ff156dfde57c8 Implement video playback and pause

##Modify button’s innerHTML

<script type="text/javascript">function playVideo(){    var videop = document.getElementById("videoId");    var videoBtn = document.getElementById("videoBtn");    if(videop.paused){
        videop.play();
        videoBtn.innerHTML = "暂停";        
    }    else{
        videop.pause();
        videoBtn.innerHTML="播放";
    }
}</script><button id="videoBtn" type="button" onclick="playVideo()">播放</button>

3. innerHTML, innerText, outerHTML, outerTextinnerHTML is an attribute that complies with W3C standards. The use of other attributes is not recommended

The following are the corresponding results of the p

values ​​of id=innerId

[Recommended tutorial: "

html video tutorial

》】【Recommended tutorial: CSS video tutorial

The above is the detailed content of How to change the wording of html submit button. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn