newbie: variable interpolation in functions

Giganews Newsgroups
Subject: newbie: variable interpolation in functions
Posted by:  seven.reeds (seven.ree…
Date: 14 Sep 2006


I am trying to create a somewhat generic function to set the initial
focus for a form.  I am tryig:

function set_focus(formID, elID)
    var form = null;
    if (document.getElementById)
        form = document.getElementById(formID);
    } else if (window.formID) {
        form = window.formID;
    if (form)

I have been using firefox and its js console tells me that "elID" has
no values when I call it as "set_focus('formName', 'firstInputName')".
It does work if I hardcode the name of the form element in the
function, a la:


How are arguments interpolated in js?