Javascript examples for DOM HTML Element:Input Text
Update textfield value by function
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){// www . j a va 2 s .c o m function UpdateField(name, val) { var fieldId = "pv-" + name; document.getElementById(fieldId).value = val; } UpdateField("field1", "a"); UpdateField("field2", "b"); UpdateField("field3", "c"); } </script> </head> <body> <input id="pv-field1"> <input id="pv-field2"> <input id="pv-field3"> </body> </html>