0
   

Function not working

 
 
pec29
 
Reply Sat 5 Nov, 2011 01:48 pm
I am trying to get my prompt to work, and it is not happening, please help.
<html>
<head>
<title>Calculator</title>
</head>
<body>
<center> <h1> Calculator</h1>
<script language="JavaScript">
var num1
var sqnum;

num1 = prompt("What is your favorite number");
sqnum = Square(num1);

document.write( "The square root of" + num1 + "is" sqnum);

function Square(x)
{
var sq = x * x;
return sq;
}
</script>
</center>
</body>
</html>
  • Topic Stats
  • Top Replies
  • Link to this Topic
Type: Question • Score: 0 • Views: 877 • Replies: 0
No top replies

 
 

Related Topics

 
  1. Forums
  2. » Function not working
Copyright © 2025 MadLab, LLC :: Terms of Service :: Privacy Policy :: Page generated in 0.05 seconds on 02/11/2025 at 10:27:11