javascript - How do I input password by clicking image with onclick function? -
i need enter-in password (without typing on keyboard) clicking on image(s) on html page onclick function or other action. how can this? tried code below, worked plain text didn't work password-type entry (as seen below). can pls me?
here codes:
<form style=" margin-left:200px; font-weight:600"> <fieldset> <legend>step ii:</legend> <input id="psx2" type="password"> <p id="psx3">all way</p> <p id="psx4">the ramp flies</p> <script> function myfunction() { x=document.getelementbyid("psx2"); // find element x.innerhtml="12345"; // change content x=document.getelementbyid("psx3"); // find element x.innerhtml="hello!"; // change content x=document.getelementbyid("psx4"); // find element x.innerhtml="hey!"; // change content } </script> <a href="#"> <img src="images/colourimages/red.jpg" alt="red not" onclick="myfunction()" width="50" height="50" id="red" /> </a> </fieldset> </form> this result:
you notice nothing showed on password field. please can help? appreciate it..
form elements not use .innerhtml change content need use .value
Comments
Post a Comment