i have this at the top of my php file
doesnt disable the field though. any ideas why?Code:<script language="JavaScript">
document.form1.txt_Username.disable = true;
</script>
Printable View
i have this at the top of my php file
doesnt disable the field though. any ideas why?Code:<script language="JavaScript">
document.form1.txt_Username.disable = true;
</script>
At the time this code is executed, the form and the text field in question probably don't exist yet. You should do this onload. And you should do it in an external JS file, of course.
Shouldn't that be disabled or is that just a typo?
why don't you use this:
It's a locked textfield.Code:<input readonly="true" type="text" name="textfield" />
<script language="JavaScript">
function disabletxtOnload(){
document.form1.txt_Username.disable = true;
}
</script>
<body onload="disabletxtOnload()">
hope this help!!:)