Uneditable text box... sort of

windows

Guest
Hi,<br />
I have text field on my page that I use to display a running total from my other fields on the form as they are being entered.<br />
<br />
I do that by running a simple java script function on the onBlur of each field summarized and onBlur and onFocus of the actual Sum field.<br />
<br />
What can I do so that the user would not be able to click in the field with the running total and enter anything in it????<br />
<br />
Is there a way??<br />
<br />
Thanks,<br />
Juls<!--content-->You can just type "disabled" in the <input> tag.<br />
<br />
Example:<br />
<textarea name="Comments" rows="4" cols="60" disabled></textarea><!--content--><input type="text" onFocus="this.blur()"><br />
<br />
is cross- browser. diabled is not supported by netscrap 4<!--content-->though sometimes this.blur will take the focus off the window itself, and pull another to the top. What I would to is use an onFocus event like this:<br />
<br />
<input type=text name=blah onFocus="document.formName.nextField.focus();" disabled><br />
<br />
I still use disabled, because the nice 'greyed out' effect in IE looks good. Then I set the focus to the next form element, so that the window wouldn't be shoved away by accident. You could alternately just use onFocus="document.body.focus();" which just keeps the window on top without doing anything else.<!--content-->
 
Back
Top