javascript - Clear a single form field in HTML -
i creating simple html login page, if enter data fields stays there when refresh page. have tried function pageinit(id) { this.browserbot.getcurrentwindow().document.getelementbyid(id).value = ''; }
doesn't (i placed onload on inputs of login.)
html:
`
<title>login</title> </head> <body> <form> <fieldset> <legend><h3>please login:</h3></legend> <input type="text" placeholder="username" name="userid" id="userid" onload="pageinit('userid');"><br> <input type="password" placeholder="password" name="passwd" id="passwd" onload="pageinit('passwd');"><br> </fieldset> </form> </body>
css:
<style> html { font-family: sans-serif; text-align: center; } { font-weight: normal; } a:hover { font-weight: bold; } #userid, #passwd { width: 30%; height: 40px; text-align: center; } </style>
js:
<script> function pageinit(id) { this.browserbot.getcurrentwindow().document.getelementbyid(id).value = ''; } </script>
document.getelementbyid('userid').value = ''
should job
Comments
Post a Comment