Thread: Resolved HTML form and Javascript
View Single Post
Old 11-12-2012, 11:17 AM   PM User | #5
adityavishnu
New to the CF scene

 
Join Date: Nov 2012
Posts: 7
Thanks: 2
Thanked 0 Times in 0 Posts
adityavishnu is an unknown quantity at this point
I don't know how to declare it as global variable but whats the matter with this case if p n r are declared globally

Code:
var p=Number(document.getElementById("pa").value);
var n=Number(document.getElementById("ny").value);
var r=Number(document.getElementById("ri").value);
function si() 
{
var s=p*n*r/100;
alert("Total Interest Amount is "+s.toFixed(2));
}

function ta() {
var s=p*n*r/100;
var t = p+s;
alert("Total Amount Payable is "+t.toFixed(2));
}
adityavishnu is offline   Reply With Quote