Bugs Happen Bugs Happen - 8 months ago 23
HTML Question

how to change value of textfield of HTML using javascript

<script type="javascript">
function display()
document.getElementById("textField1").value = "abc";

<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()">

but the value of textfield is not changing.

Any Ideas what am i doing wrong ??



<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: