Jump to content

Passing value from sub to function


Recommended Posts

Hey there guys... I would like to know how to get info using a sub pro and then pass it to the function to work on it using conditional statment and then display the result... thanks in advance appspl take a look at this script i dont understand how to make it work.. I want to get the age from the user and if it is 30 then with print or put a msgbox saying "congrats"... <html><head><script type="text/vbscript">public sub ageinfo()dim ageage=inputbox("Please enter your age")end subfunction agegreet()i=ageif i=30 thendocument.write("Congrats")end ifend function</script></head><body><script type="text/vbscript">call ageinfo()call agegreet()</script></body></html>

Link to post
Share on other sites

Voila....

<html><head><script language="vbscript"><!--sub whatAge()    age = trim(age)     if isnumeric(age) then        document.write("You Are "& age &" Years Old!")        if age=30 then             alert("Congrats, You Are 30!!")        end if     end ifend subdim ageage=inputbox("Please enter your age")--></script></head><body><script type="text/vbscript">    call whatAge()</script></body></html>

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...