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

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

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......

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

function hypotenuse(){

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

//-->
</script>
<body>
<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. No Profile Picture
Contributing User
Devshed Intermediate (1500 - 1999 posts)

Join Date
Nov 2001
Posts
1,882
Rep Power
20
Here is some very basic code to get you going.

Code:
```<html><head><title>Hypotenuse</title>

<script language="JavaScript">
<!--hide from old browsers

function hypotenuse(){
var c = Math.sqrt((a*a)+(b*b))

equation = window.open("open", "equation", "width=330,height=250");
equation.focus();
equation.document.open();
equation.document.write('Hypotenuse = ' + c +'<br><a href="javascript:window.close()">Close this Window</a>');
equation.document.close();
}

//-->
</script>
<body>
<input type="text" name="a" value=""> enter side A.<br>
<input type="text" name="b" value=""> enter side B.<br>

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

</form>
</body></html>```