search

Home  >  Q&A  >  body text

javascript - <input onblur="value=100">Why can the value here be obtained directly?

You cannot write like this in js. How do you write it in js file?

我想大声告诉你我想大声告诉你2858 days ago458

reply all(1)I'll reply

  • 阿神

    阿神2017-05-18 10:55:16

    Use this to transfer the control to js.

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>index</title>
    
    </head>
    
    <body>
    <input type="text" name="text" id="test" value="" onblur="a(this)"/>
    <button onclick="init()">123333</button>
    
    </body>
    <script>
    function init(){
        document.getElementById("test").value = '';
    }
    function a(text){
        text.value = 100;
    }
    </script>
    </html>

    reply
    0
  • Cancelreply