Page 1 of 1
How to alert math with javascript?
Posted: Thu Jul 03, 2014 8:51 am
by Nicklas
Hey!
I have two Input(fields) that I have named "InOne" and "InTwo".
In this fields I want the user to input numbers, for example: InOne = 20 and InTwo = 2.
When the user click a button named "Calculate" I want a "alert window" to pop up where the answer is written (Answer = InOne/InTwo).
How can I make this to work with JavaScript (Event = Click, Action = Run JavaScript).
I have tried to make this to work for a week now but I cant make this work.
How to alert math with javascript?
Posted: Thu Jul 03, 2014 9:55 am
by Evgene Karachevtsev
Hello Nicklas,
You may try this code
codevar one, two;
one = parseInt(Appery("InOne").val());
two = parseInt(Appery("InTwo").val());
alert(one/two);/code
How to alert math with javascript?
Posted: Thu Jul 03, 2014 10:13 am
by Nicklas
Thank you very much!!
Another question
Is it possible to do the same but get the answer in another Input, or a label, textfield etc., not a alert?
How to alert math with javascript?
Posted: Thu Jul 03, 2014 11:44 am
by Evgene Karachevtsev
Hello Nicklas,
You should use this code to write to label:
codeAppery("labelName").text(one/two);/code
instead of
codealert(one/two);/code
Please read more here http://devcenter.appery.io/documentat...
How to alert math with javascript?
Posted: Fri Jul 04, 2014 1:40 pm
by Nicklas
No I meen:
I want the answer to show up in a label under the button, not an alert.
How to alert math with javascript?
Posted: Sun Jul 06, 2014 5:01 pm
by Nicklas
Is it possible to do the same (Appery("labelName").text(one/two);) with a Input(field)?
Like Appery("InputName").text(one/two);. I tried this one, but it doesn't work.
How to alert math with javascript?
Posted: Sun Jul 06, 2014 5:09 pm
by Nicklas
Oh! I need val instead of text...
Thanks anyway:)
How to alert math with javascript?
Posted: Sun Jul 06, 2014 5:13 pm
by Evgene Karachevtsev
Hello Nicklas,
Thank you for the update. Do not hesitate to contact us if you need any further help.