Question:

Java Script Question

by  |  earlier

0 LIKES UnLike

I'm trying to make a calculator using Java and am having some trouble.

A sample of something that i am looking to achieve is like on this site linked: http://moneychimp.com/articles/valuation/pe_ratio.htm

I want something that i can have people who visit my site enter data, hit calculate and get a number.

Any ideas would be great.

Thanks

 Tags:

   Report

1 ANSWERS


  1. First I'd like to mention that Java and Javascript are two different languages and have little to do with each other.

    Here's a simple example of a calculator:

    <html>

    <body>

    <script type="text/javascript">

    function calculate()

    {

    var a=document.getElementById("a");

    var b=document.getElementById("b");

    var ans=document.getElementById("ans")

    ans.value = parseInt(a.value) + parseInt(b.value);

    }

    </script>

    <label for="a">A: </label>

    <input type="text" name="a" id="a" size="2"/>

    and <label for="b">B: </label>

    <input type="text" name="b" id="b" size="2"/>

    is <input type="text" name="ans"/>

    <input type="submit" onclick="calculate()" value="Calculate"/>

    </body>

    </html>

You're reading: Java Script Question

Question Stats

Latest activity: earlier.
This question has 1 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.