I have several functions that are somewhat redundant, and I would like to get rid of multiple functions by passing the "control" that the function is operating on as a parameter.
For example, currently we have:
function x1(data)
{
window.document.myForm.text1.value = data;
}
function x2(data)
{
window.document.myForm.text2.value = data;
}
What I would like to do is this:
function x(data,control)
{
window.document.myForm.[control].value = data;
}
But when I try that I get an error saying that it is not an object.
How do I do this?
Thanks,
John
For example, currently we have:
function x1(data)
{
window.document.myForm.text1.value = data;
}
function x2(data)
{
window.document.myForm.text2.value = data;
}
What I would like to do is this:
function x(data,control)
{
window.document.myForm.[control].value = data;
}
But when I try that I get an error saying that it is not an object.
How do I do this?
Thanks,
John