i want to use multiple function in a script.i am not getting calculated value in second textbox. i dont know what is wrong in my program. returning no value.
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script>
function fun1()
{
var z=5;
function fun3(x)
{
alert("i am fun3");
var y=x+z;
}
return y;
}
function fun2()
{
var a = document.getElementById("txt1").value;
var result = fun3(a);
document.getElementById("txt2").innerHTML=result;
}
</script>
</head>
<body>
Enter no: <input type="text" value="" id="txt1" onkeydown="fun2();">
Result: <input type="text" value="" id="txt2" />
</body>
</html>
fun3can't be called fromfun2because it is defined infun1and therefore only available in that scope. Move it besidefun1/fun2