Click to See Complete Forum and Search --> : Passing parameters to a javascript function


nirbhay78
01-21-2003, 05:04 PM
hi I am using the following function to submit one of many forms on a page with the use of a link.

function SubmitForm(p) {
document.p.submit();
}

The problem is that my browser, and i figure everyone else's browser does not like p as a parameter, and actually looks for the form called "p". How can i write this function so that i can pass the name of the form into this function and submit the desired form?

Any help would be well appreciated.

thnx

Sergey Smirnov
01-21-2003, 05:29 PM
try to use document[p]
i.e
function SubmitForm(p) {
document[p].submit();
}