#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2002
    Location
    Atlanta GA
    Posts
    15
    Rep Power
    0

    Unhappy Please Help!! Javascript problem: c squared=a squared*b squared


    I need help with this Java Script problem. It is supposed to be able to solve the problem

    c*c=a*a=B*b or c squared= a squared*bsquared

    and I need the answer to pop up in a new page in a new javascript and have a close tag. (window.close)

    I'm so lost...my second wk of javascript in school and I have NO idea what I'm doing. Could anyone please look at my code and help me?

    Thanks,
    Tracy

    Here it is......


    <html><head><title>Hypotenuse</title>

    <script language="JavaScript">
    <!--hide from old browsers
    document.write("This is JavaScript")


    function hypotenuse(){
    a=c*c=(document.add.a*a.value)+
    (document.add.b*b.value)
    alert(a);


    function newWindow(open) {
    equation = window.open("open", "equation", "width=330,height=250");
    equation.focus();
    }


    //-->
    </script>
    </head>
    <body>
    <form name="add">
    <input type="text" name="a+a" value=""> enter side A.<br>
    <input type="text" name="b+b" value=""> enter side B.<br>
    <a href="javascript:newWindow(open)"></a>

    <input type="button" value="submit"
    onClick=" hypotenuse();">

    </form>
    </body></html>
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2002
    Posts
    10
    Rep Power
    0
    Try taking it one line at a time!

    function hypotenuse(){
    var a = ;
    var b = ;
    var csquared = ;
    var c = ;

    // and dont forget to close the function with..

    }

    //Dont use "+" in the names of the form input fields,
    //to find the square root use Math.sqrt();

    //to write to a new window use something like this in your function..

    windowprops=",width=200, height=50, top=100, left=100, toolbar=0,directories=0,menubar=0";

    popupWin=window.open('','',windowprops);
    popupWin.document.open();
    popupWin.document.writeln("<HTML><HEAD></HEAD><BODY>");
    popupWin.document.close();

IMN logo majestic logo threadwatch logo seochat tools logo