Sunday, 15 September 2024

WRITE A JAVASCRIPT TO PRINT BANK MENU





1.DEPOSIT

2.WITHDRAWAL

3.ACCOUNT DETAILS

4.EXIT

CODE:-

<html>

<head>

<title>Bank Menu</title>

<style type="text/css">

body{

background-color:lightgreen;

}

.tab{

background-color:grey;

color:;

text-transform:capitalize;

}

.v1{

text-align:center;

background-color:orange;

}

.v2{

text-align:center;

background-color:yellow;

}

</style>

<script type="text/javascript">

function check()

{

var no=document.f1.ch.value;

var bal=10000,tot=0;

if(no==1)

{

var tot=parseInt(prompt("Enter Deposit Amount"));

document.f1.dep.value=tot;

var totbl=bal+tot;

document.f1.totbl.value=totbl;

}

else if(no==2)

{

var wit=parseInt(prompt("Enter Withdrawal Amount"));

document.f1.wit.value=wit;

var ans=bal-wit;

document.f1.totbl.value=ans;

}

else if(no==3)

{

document.write("<br> Name:- Vivek L Parmar");

}

else if(no==4)

{

document.write("Exited Account");

}

else

{

alert("Invalid Choice");

}

return false;

}

</script>

</head>

<body>

<center>

<form name="f1" method="post" onsubmit="return check()">

<table border="1" cellspacing="0" class="tab">

<tr class="v1">

<th colspan="2">bank menu</th>

</tr>

<tr>

<th colspan="2">1.deposit</th>

</tr>

<tr>

<th colspan="2">2.withdrawal</th>

</tr>

<tr>

<th colspan="2">3.account detalis</th>

</tr>

<tr>

<th colspan="2">4.exit</th>

</tr>

<tr class="v2">

<th>enter your choice:-</th>

<td><input type="text" name="ch" size="5" style="border-radius:15px;"></td>

</tr>

<tr class="v1">

<td colspan="2">

<input type="submit" name="submit" value="Submit" style="border-radius:8px;background-color:red;color:white;font-weight:bold;border-color:green;">

<input type="reset" name="reset" value="Reset" style="border-radius:8px;background-color:red;color:white;font-weight:bold;border-color:green;">

</td>

</tr>

<tr>

<th>deposited amount:</th>

<td><input type="text" name="dep"></td>

</tr>

<tr>

<th>withdrawal amount:</th>

<td><input type="text" name="wit"></td>

</tr>

<tr>

<th>total balance:</th>

<td><input type="text" name="totbl"></td>

</tr>

</table>

</form>

</center>

</body>

</html>


No comments:

Post a Comment