Well, I'm really new into JS and I'm actually more into C++, but I decided to give it a try since I'd love to develop some online games, using the new Canvas element HTML5 is providing. But before that i need to get the basics.
What I'm trying to do here is a web application capable of solving some High School math problems related to Sine, Cosine, Tangent....
But I'm getting an "Undefined" Error, when trying to run a simple test. Here's the code, It's in spanish, but I think It's pretty much self-explaining, though I've modified the important parts
HTML!
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript" src="FuncionesTrigonometricas.js"></script>
<title>Funciones trigonometricas</title>
</head>
<body>
Funcion Inicial
<FORM name="myForm">
<select name="InitialFunction" onChange='test()'>
<option SELECTED> --Please, select a trigonometric function -- </option>
<OPTION VALUE="sin"> Seno </option>
<option value="cos"> Coseno </option>
<option value="tan"> Tangente </option>
<option value="cot"> Contangente </option>
<option value="sec"> Secante </option>
<option value="csc"> Cosecante </option>
</select>
</form>
<br>
</body>
</html>
Javascript!
var InitialFunctionJS = document.myForm.InitialFunction.value;
function test() {
alert(InitialFunctionJS);
}
I mean, the alert does shows, but it says: "Undefined"
P.D. I tried: document.write(InitialFunctionJS); , same result.