Click to See Complete Forum and Search --> : Determing Parm Values in Functions


clyde
01-12-2004, 08:12 AM
I am Really Confused on how I can pass a Parm and use the value of the parm which is the field name, in the code below.
The Value of the Field passed below is "DMMDA".

When I use the code below I get an Error that field is not a valid field or undefined. I can get the value of the field by using field.name, but how do I use it in code below.

Any Help would be appreciated.


function InfReset(field)
{
document.prompt.field.focus();
document.prompt.field.value = "";
}

Khalid Ali
01-12-2004, 08:16 AM
not sure how does your other code look like(html part that triggers this method), here is what will work

field.focus()

TheBearMay
01-12-2004, 09:07 AM
You don't really need to set focus first either:



...
function rSetTxt(field){
eval(field).value="";
}
...
<input type="text" id="rSet"/><br/>
<button onclick="rSetTxt('rSet');">Reset</button>

clyde
01-12-2004, 09:43 AM
Based on the 2 postings I was able to resolve the problem.

I am amazed at the knowledge out there.

Thanks
Clyde