Saturday 17 January 2015

Javascript programming




Q. Write a program to enter two numbers from user and on clicking "Result", it will give the percentage of two numbers along with the image on a different web page.

<html>
<head>
<script>
function f1()
{
t1=parseInt(document.ff.t1.value)
t2=parseInt(document.ff.t2.value)
t=t1+t2
tr=(t1+t2)/2
 document.write("<img src=1.jpg height=100 width=100></img><br>Result 2015<br>"+"DCAP I:"+t1+"<br>DCAP II:"+t2+"<br>Total: "+t+"<br>Percentage: "+tr")
}
</script>
</head>

<body>
<form name=ff>
<marquee behavior=scroll><center><h1>WEB DESIGNING</h1></marquee><br>
DCAP1&nbsp&nbsp&nbsp<input type=textbox name=t1><br><br>
DCAP2&nbsp&nbsp&nbsp<input type=textbox name=t2><br><br>
<input type=button value=Result onClick="f1()"></center><br>
</form>
</body>
</html>




No comments:

Post a Comment