Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

function that get's variable & uses it in document.form.variable.value 1

Status
Not open for further replies.

PS1983

Technical User
Nov 6, 2001
83
AT
Hi!
I'm wondering if it's possible to use variables in the document.* string...

my example

function checkAmount(amount){
if (document.form.amount.value != 0){
blablabla
}
}

I hope you can understand my problem =)

Your help is very appreciated!
Thanks in advance, steve

 
It sure is:

Code:
function checkAmount(amount)
{
  if (document.getElementById(amount).value != 0)
  {
    blablabla
  }
}

And then make sure your form elements have IDs...

Hope this helps!

Dan
 
Your're right, that works wonderful!
Thank you very much!
Bye steve

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top