using variables in a function

Results 1 to 3 of 3

Thread: using variables in a function

  1. #1
    Terry Green Guest

    Default using variables in a function

    when a button is clicked on the form i'm building, I use the vbscript function onClick to check which button was clicked and need to update a hidden variable on my form if the correct button was clicked. Nothing I've tried seems to work. HELP!!!!!

  2. #2
    Join Date
    Dec 1969

    Default RE: using variables in a function

    Give each button a descriptive name like "update", "delete", etc. Then make a call in the onclick event like so,<BR><BR>&#060;input type=button name=update value="update now" onclick="process(this)"&#062;<BR><BR>now if you have a hidden control named "type", you can set its value with the function process(),<BR><BR>function process(obj){<BR>myform.type.value =<BR>myform.submit()<BR>}

  3. #3
    Terry Green Guest

    Default RE: using variables in a function

    Thanks Moshe. I actually ended up using the following for each button:<BR><BR>&#060;script for="OptionB" event="OnClick" language="VBscript"&#062;<BR> correct = form1.correct.value<BR> whycorrect = "Correct! " & form1.whycorrect.value<BR> whywrong = "I&#039;m sorry. The Correct answer is " & form1.correct.value & ". " & form1.whywrong.value<BR> if correct = "B" then<BR> msgbox whycorrect<BR> form1.NumberCorrect.value = int(form1.NumberCorrect.value) + 1<BR> else<BR> msgbox whywrong<BR> end if <BR>form1.submit()<BR>&#060;/script&#062;

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts