I have a hidden field whose value is a text string, "xyz". I want to write the value to the page so that the user can see it but not edit it. Can't I just use document.write(form.field.value)? Why isn't it working?

<html> <head> <title>untitled</title> </head> <body> <form> <input name="secret" type="hidden" value="xyz"> </form> <p style="font:200 14px helvetica;color:navy;"> I want to write the value to the page so that the user can see it but not edit it: <script type="text/javascript" language="JavaScript"> document.write('<strong>' + document.forms[0].secret.value + '</strong>'); </script> </p> </body> </html>
Comment