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!! Link to comment https://forums.phpfreaks.com/topic/67371-parameters-problem/ 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() } Link to comment https://forums.phpfreaks.com/topic/67371-parameters-problem/#findComment-338640 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. Link to comment https://forums.phpfreaks.com/topic/67371-parameters-problem/#findComment-338646 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.