function showChange() { var select = document.getElementById("x"); var value = parseInt(select.options[select.selectedIndex].text); alert(value); } function measureDistance() { var select = document.getElementById("x"); var valueX = parseInt(select.options[select.selectedIndex].text); select = document.getElementById("y"); var valueY = parseInt(select.options[select.selectedIndex].text); var result = Math.Sqrt(Math.Pow(valueY, 2) + Math.Pow(valueX, 2)) alert(result); } <body> <FORM name="form"> <select id="x" name="x" onChange="showChange()"> <option name="0"> 0</option> <option name="1"> 1</option> <option name="2"> 2</option> </select> <select id="y" name="y" onChange="measureDistance()"> <option name="0"> 0</option> <option name="1"> 1</option> <option name="2"> 2</option> </select> </FORM> </body> I don’t understand why showChange() works, but measureDistance () doesn’t. The code should perform a simple task of calculating the coordinates (using select ) the distance to the point. Google Chrome does not work.
Math.sqrt,Math.pow- Igor