Jump to content

Passing value from sub to function


aparna_881

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 comment
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 comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...