how to change value of textfield of HTML using javascript

forms, html, javascript

Solution

try

<script type="text/javascript">

instead of

<script type="javascript">

. I believe the latter is not a valid syntax.

Removing the `type` attribute entirely works as well:

<script>

Problem

``` <head> <script type="javascript"> function display() { document.getElementById("textField1").value = "abc"; } </script> </head> <body> <form id="form1" action="http://google.com"> <input id="textField1" type="text" value="0" align="right" size="13"/><br> <input id="button1" type="button" value="1" onclick="display()"> </form> </body> ``` but the value of textfield is not changing. Any Ideas what am i doing wrong ??

Original source