do***@tpg.com.au (TempMan) writes:
I want this text field to always display a number variable.
The variable "num" is defined in the head, how can I get a text box to
display this varibale??
<input name="Balance" type="text" value="num" size="8" maxlength="8">
You have to add the value using Javascript. The code for this is:
document.forms['formName'].elements['Balance'].value = num;
You can either use this code anywhere after the element tag:
<script type="text/javascript">
document.forms['formName'].elements['Balance'].value = num;
</script>
(Remember to use the "type" attribute, not the "language" attribute
on the script tag, if writing HTML 4 or later).
Or you can add it using the documents onload handler:
<body
onload="document.forms['formName'].elements['Balance'].value = num;">
(don't put "javascript
:" in front of HTML event handlers, it is not
a link, so the javascript
: pseudo protocol doesn't apply).
/L
--
Lasse Reichstein Nielsen -
lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
'Faith without judgement merely degrades the spirit divine.'