JP128 Posted February 11, 2007 Share Posted February 11, 2007 <script language="javascript"> function clearData(fieldName){ document.form1.fieldName.value=""; } </script> How would I go about this? I want to be able to create an input field, with onClick="clearData('username');"... I have tried: document.form1.fieldName.value=""; document.form1.'fieldName'.value=""; document.form1.+fieldName+.value=""; document.form1.+ "fieldName" +.value=""; Quote Link to comment https://forums.phpfreaks.com/topic/37989-documentform-value-returns-an-error/ Share on other sites More sharing options...
JP128 Posted February 11, 2007 Author Share Posted February 11, 2007 <script language="javascript"> function clearData(field){ document.getElementById(field).value=""; } </script> thats what I used... Quote Link to comment https://forums.phpfreaks.com/topic/37989-documentform-value-returns-an-error/#findComment-181799 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.