Lefu Posted August 30, 2007 Share Posted August 30, 2007 hello my friends, I have this: function setmadeid(fieldname,fieldvalue) { document.joe.fieldname.value= fieldvalue; document.joe.submit(); } it is just a function to receive field name and value, my problem is telling javascript that the first parameter is the name of my textbox which I am changing the value. Can some one help me, just trying to reuse this function for many all the fields instead of having to redeclare extra functions, help please!! Quote Link to comment Share on other sites More sharing options...
Daniel0 Posted August 31, 2007 Share Posted August 31, 2007 Give the field an id instead and do: function setmadeid(obj_id, field_value) { document.getElementById(obj_id).value = field_value document.joe.submit() } Quote Link to comment Share on other sites More sharing options...
Daniel0 Posted August 31, 2007 Share Posted August 31, 2007 You might try this: document.forms['joe'].elements[fieldname].value = fieldvalue too. Quote Link to comment 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.