Showing posts with label #javascript #programming #code #computer #coding. Show all posts
Showing posts with label #javascript #programming #code #computer #coding. Show all posts

Wednesday, 18 September 2024

WRITE A JAVASCRIPT TO PRINT SUM OF GIVEN ODD OR EVEN NUMBERS


CODE:-

<html>

<head>

<title>Even Or Odd Sum</title>

<style type="text/css">

body{

background-color:yellow;

}

.tab{

text-transform:capitalize;

background-color:lightgrey;

}

.v2{

text-align:center;

}

.v1{

background-color:purple;

color:white;

text-transform:uppercase;

}

</style>

<script type="text/javascript">

function check()

{

var no=parseInt(document.f1.no.value);

var even=0,odd=0,sodd=0,seven=0;

for(var i=1;i<=no;i++)

{

if(i%2==0)

{

even++;

seven=seven+i;

}

else

{

odd++;

sodd=sodd+i;

}

}

document.f1.even.value=even;

document.f1.seven.value=seven;

document.f1.odd.value=odd;

document.f1.sodd.value=sodd;

return false;

}

</script>

</head>

<body>

<center>

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

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

<tr class="v1">

<th colspan="2"><h5>sum of even or odd number</h5></th>

</tr>

<tr>

<th>enter number:-</th>

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

</tr>

<tr class="v2">

<td colspan="2">

<input type="submit" name="submit" value="Submit" style="border-radius:10px;background-color:lightgreen;border-color:orange;color:red;">

<input type="reset" name="reset" value="Reset" style="border-radius:10px;background-color:lightgreen;border-color:orange;color:red;">

</td>

</tr>

<tr>

<th>even numbers:-</th>

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

</tr>

<tr>

<th>odd numbers:-</th>

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

</tr>

<tr>

<th>sum of even numbers:-</th>

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

</tr>

<tr>

<th>sum of odd numbers:-</th>

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

</tr>

</table>

</form>

</center>

</body>

</html>


WRITE A JAVASCRIPT TO PRINT FACTORIAL OF GIVEN NUMBER

CODE:-

<html>

<head>

<title>Factorial</title>

<style type="text/css">

body{

background-color:lightgreen;

}

.tab{

background-color:yellow;

color:;

text-transform:capitalize;

}

.v1{

text-align:center;

background-color:lightblue;

}

.v2{

text-align:center;

background-color:blue;

color:white;

}

</style>

<script type="text/javascript">

function check()

{

var a=document.f1.no.value;

var i,fact=1;

for(i=1;i<=a;i++)

{

fact=fact*i;

}

document.f1.ans.value=fact;

return false;

}

</script>

</head>

<body>

<center>

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

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

<tr class="v2">

<th colspan="2">factorial of given number</th>

</tr>

<tr>

<th>enter number:</th>

<td><input type="text" name="no" size="5" style="border-radius:10px;"></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>factorial is:</th>

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

</tr>

</table>

</form>

</center>

</body>

</html>


WRITE A JAVASCRIPT TO PRINT GIVEN NUMBER IS PALINDROME OR NOT


CODE:-

<html>

<head>

<title>Palindrome</title>

<style type="text/css">

body{

background-color:lightgreen;

}

.v1{

text-align:center;

}

.tab{

background-color:lightblue;

text-transform:capitalize;

}

.v2{

text-align:center;

text-transform:capitalize;

background-color:lightgrey;

color:red;

}

</style>

<script type="text/javascript">

function check()

{

var no,i,temp,rem,rev=0;

no=parseInt(document.f1.no.value);

temp=no;

while(no>0)

{

rem=no%10;

no=parseInt(no/10);

rev=(rev*10)+rem;

}

if(rev==temp)

{

var an=["Yes"];

document.f1.ans.value=an;

}

else

{

var a=["No"];

document.f1.ans.value=a;

}

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">to check palindrome of given number</th>

</tr>

<tr>

<th>enter number:-</th>

<td><input type="text" name="no" size="5" style="border-radius:10px;"></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>given number:-</th>

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

</tr>

</table>

</form>

</center>

</body>

</html>


WRITE A JAVASCRIPT TO READ TIME AND PEFORM HOUR MINUTE SECOND

 Write a JavaScript program to read a time from user and perform the following, if entered value is time then perform the following

 

1.Display the hour from the time

2.Display the minute from the time

3.Display the second from the time

4.Change the hour to next hour

5.Change the minute to next minute

6.change the second to next second


<html>

<head>

<title>Time Processor</title>

<script>

function processTime() 

{

  var timeInput = document.getElementById("timeInput").value;

  var timeParts = timeInput.split(":");

if (timeParts.length !== 3) 

{

    alert("Invalid time format.Please enter time in HH:MM:SS format.");

    return;

  }


  var hour = parseInt(timeParts[0]);

  var minute = parseInt(timeParts[1]);

  var second = parseInt(timeParts[2]);


  document.getElementById("hr").value = hour;

  document.getElementById("min").value = minute;

  document.getElementById("sec").value = second;


  var nexthr=(hour + 1)%24;    document.getElementById("nexthr").value=nexthr;


  var nextmin=(minute + 1)%60;

  document.getElementById("nextmin").value=nextmin;


  var nextsec=(second + 1)%60;

  document.getElementById("nextsec").value=nextsec;

}

</script>

</head>

<body>

<h1>Time Processor</h1> 

<h3> Enter Time (HH:MM:SS): <input type="text" id="timeInput" value="00:00:00">

<button onclick="processTime()">Process Time</button> </h3>

<table border="1">

<tr>

  <td> Hour: </td> 

<td> <input type="text" id="hr" readonly> </td>

</tr>

<tr>

<td> Minute </td>

<td> <input type="text" id="min" readonly> </td>

</tr>

<tr>

<td> Second: </td>

<td> <input type="text" id="sec" readonly> </td>

</tr>

<tr>

<td> Next Hour: </td>

<td> <input type="text" id="nexthr" readonly> </td>

</tr>

<tr>

<td> Next Minute:</td>

<td> <input type="text" id="nextmin" readonly> </td>

</tr>

</tr>

<td> Next Second:</td>

<td> <input type="text" id="nextsec" readonly> </td>

</tr>

</table>

</body>

</html>

WRITE A JAVASCRIPT TO READ DATE AND PEFORM DAY NO YEAR MONTH

Write a JavaScript program to read a date from user and perform the following, if entered value is date then perform the following

 

1.Display the day no from the date

2.Display the year from the date

3.Display the month from the date

4.Change the date to next day

5.Change the year to next year

6.change the month to next month 


<html>

  <head>

<style type="text/css">

td{text-align:center;

}

}

</style>

  <script>

      function processDate() 

{

        var dateInput = document.getElementById("dateInput").value;

        var date = new Date(dateInput);


        

        document.getElementById("day").value = date.getDate();


        

        document.getElementById("year").value = date.getFullYear();


        var monthNames = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];

        document.getElementById("month").value = monthNames[date.getMonth()];


        var nextDay = new Date(date);

        nextDay.setDate(nextDay.getDate() + 1);

        document.getElementById("nextDay").value = nextDay.toLocaleDateString();


        var nextYear = new Date(date);

        nextYear.setFullYear(nextYear.getFullYear() + 1);

        nextYear.setDate(date.getDate());

        document.getElementById("nextYear").value = nextYear.toLocaleDateString();


        var nextMonth = new Date(date);

        nextMonth.setMonth(nextMonth.getMonth() + 1);

        nextMonth.setDate(date.getDate());

        document.getElementById("nextMonth").value = nextMonth.toLocaleDateString();

      }

    </script>

</head>

<body>

<h3 align="center"> <input type="date" id="dateInput"> </td>

    <button onclick="processDate()"> Process Date </button> </h3>

    <table border="1" align="center"> 

<tr> 

<td> Day: </td>

<td> <input type="text" id="day"> </td>

</tr>

<tr>

<td> Year: </td>

<td> <input type="text" id="year"> </td>

</tr>

<tr>

<td> Month: </td>

<td> <input type="text" id="month"> </td>

</tr>

    <tr>

<td> Next Day: </td>

<td> <input type="text" id="nextDay"> </td>

</tr>

<tr>

<td> Next Year: </td>

<td> <input type="text" id="nextYear"> </td>

</tr>

<tr>

<td> Next Month: </td>

<td> <input type="text" id="nextMonth"> </td>

</tr>

</table>

  </body>

</html>

Tuesday, 17 September 2024

WRITE A JAVASCRIPT TO PERFORM AIRTHMETIC OPERATION ON BUTTON CLICK EVENT

 




<html>

<head><title>Example-8</title>

<script language="JavaScript">

function add() {

var num1=document.getElementById("txt_num1").value;

var num2=document.getElementById("txt_num2").value;

var n1=parseInt(num1);

var n2=parseInt(num2);

var ans=n1+n2;

document.getElementById("txt_res").value=ans;

}

function sub() {

var num1=document.getElementById("txt_num1").value;

var num2=document.getElementById("txt_num2").value;

var n1=parseInt(num1);

var n2=parseInt(num2);

var ans=n1-n2;

document.getElementById("txt_res").value=ans;

}

function mul() {

var num1=document.getElementById("txt_num1").value;

var num2=document.getElementById("txt_num2").value;

var n1=parseInt(num1);

var n2=parseInt(num2);

var ans=n1*n2;

document.getElementById("txt_res").value=ans;

}

function div() {

var num1=document.getElementById("txt_num1").value;

var num2=document.getElementById("txt_num2").value;

var n1=parseInt(num1);

var n2=parseInt(num2);

var ans=n2/n1;

document.getElementById("txt_res").value=ans;

}

</script>

</head>


<body>

<form method="POST">

<table border="2px">

<tr>

<th>Number1:</th>

<td><input type="text" id="txt_num1"/></td>

</tr>

<tr>

<th>Number2:</th>

<td><input type="text" id="txt_num2"/></td>

</tr>

<tr>

<td colspan="2" align="center"><input type="button" value="ADD"

onclick="add()"/>

<input type="button" value="SUB" onclick="sub()"/>

<input type="button" value="MUL" onclick="mul()"/>

<input type="button" value="DIV" onclick="div()"/></td>

</tr>

<tr>

<th>RESULT:</th>

<td><input type="text" id="txt_res"/></td>

</tr>

</table>

</form>

</body>

</html>

WRITE A JAVASCRIPT TO INPUT FORM DATA AND PRINT THEM



CODE


 <html>

<head><title>Example-12</title>

<script language="JavaScript">

function showData() {

var rno=parseInt(document.getElementById("txt_rno").value);

var name=document.getElementById("txt_name").value;

var male=document.getElementById("male").checked;

if(male == true)

var male1="Male";

else

male1="Female";

//alert(male1);

var read1=document.getElementById("read").checked;

var write1=document.getElementById("write").checked;

var speak1=document.getElementById("speak").checked;

//alert(read1);

if(read1 == true && write1 == true && speak1 == true) {

var a="Read, Write, Speak";

document.write("Hello Sir/Madam, "+name+", Your registration Number: "+rno+"has been selected due to your english ability: "+a+"Your gender is: "+male1);

}

else if(read1 == true && write1 == true) {

var a="Read, Write";

document.write("Hello Sir/Madam, "+name+", Your registration Number: "+rno+"has been selected due to your english ability: "+a+"Your gender is: "+male1);

}

else if(read1 == true && speak1 == true) {

var a="Read, Speak";

document.write("Hello Sir/Madam, "+name+", Your registration Number: "+rno+"has been selected due to your english ability: "+a+"Your gender is: "+male1);

}

else if(write1 == true && speak1 == true) {

var a="Write, Speak";

document.write("Hello Sir/Madam, "+name+", Your registration Number: "+rno+"has been selected due to your english ability: "+a+"Your gender is: "+male1);

}

else if(read1 == true) {

var a="Read";

document.write("Hello Sir/Madam, "+name+", Your registration Number: "+rno+"has been selected due to your english ability: "+a+"Your gender is: "+male1);

}

else if(write1 == true) {

var a="Write";

document.write("Hello Sir/Madam, "+name+", Your registration Number: "+rno+"has been selected due to your english ability: "+a+"Your gender is: "+male1);

}

else if(speak1 == true) {

var a="Speak";

document.write("Hello Sir/Madam, "+name+", Your registration Number: "+rno+"has been selected due to your english ability: "+a+"Your gender is: "+male1);

}

else {

alert("Please provide valid data");

}

}

</script>

</head>


<body>

<form method="POST" action="P12.html">

<table border="2px">

<tr>

<th align="center" colspan="2"><u>User Login Form:</u></th>

</tr>

<tr>

<th>Registeration Number:</th>

<td><input type="text" id="txt_rno" required/></td>

</tr>

<tr>

<th>Name:</th>

<td><input type="text" id="txt_name" required/></td>

</tr>

<tr>

<th>Gender:</th>

<td><input type="radio" name="gen" value="Male" id="male"/>Male

<input type="radio" name="gen" value="Female" id="female"/>Female</td>

</tr>

<tr>

<th>English Ability:</th>

<td><input type="checkbox" name="chk_read" value="Read" id="read" />Read

<input type="checkbox" name="chk_write" value="Write" id="write" />Write

<input type="checkbox" name="chk_speak" value="Speak" id="speak" />Speak</td>

</tr>

<tr>

<td colspan="2" align="center"><input type="button" value="CLICK" onclick="showData()"/>

<input type="reset" value="Reset"/></td>

</tr>

</table>

</form>

</body>

</html>

WRITE A JAVASCRIPT TO PRINT CUBE OF GIVEN NUMBER

 WRITE A JAVASCRIPT TO PRINT SQUARE OF GIVEN NUMBER

CODE:-

<html>

<head>

<title>Square</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=parseInt(document.f1.no.value);

var ans=no*no*no;

document.f1.ans.value=ans;

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">to print square of given number</th>

</tr>

<tr>

<th>enter number:-</th>

<td><input type="text" name="no" size="5" style="border-radius:10px;"></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>square of given number:-</th>

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

</tr>

</table>

</form>

</center>

</body>

</html>


WRITE A JAVASCRIPT TO PRINT SQUARE OF GIVEN NUMBER


CODE:-

<html>

<head>

<title>Square</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=parseInt(document.f1.no.value);

var ans=no*no;

document.f1.ans.value=ans;

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">to print square of given number</th>

</tr>

<tr>

<th>enter number:-</th>

<td><input type="text" name="no" size="5" style="border-radius:10px;"></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>square of given number:-</th>

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

</tr>

</table>

</form>

</center>

</body>

</html>


WRITE A JAVASCRIPT TO PRINT ODD NUMBER FROM 1 TO 10

 WRITE A JAVASCRIPT TO PRINT EVEN NUMBER FROM 1 TO 10

CODE:-

<html>

<head>

<title>Even No</title>

<script type="text/javascript">

var i=1;

document.write("EVEN NUMBERS");

for(i=1;i<=10;i++)

{

if(i%2!=0)

{

document.write("<br>"+i);

}

}

</script>

</head>

<body>

</body>

</html>


WRITE A JAVASCRIPT TO PRINT EVEN NUMBER FROM 1 TO 10


CODE:-

<html>

<head>

<title>Even No</title>

<script type="text/javascript">

var i=1;

document.write("EVEN NUMBERS");

for(i=1;i<=10;i++)

{

if(i%2==0)

{

document.write("<br>"+i);

}

}

</script>

</head>

<body>

</body>

</html>


Monday, 16 September 2024

WRITE A JAVASCRIPT TO CHECK USERID AND PASSWORD IS SAME OR NOT

 <!DOCTYPE html>

<html>

<body>

<h2> Write a program to check Uid and Password 

are X and Y (X and Y will be fixed strings of your choice). </h2>


<table border="2px">

<tr>

<th>Enter UserName: </th>

<td><input type="text" name="txt_username" 

id="username"/></td>

</tr>

<tr>

<th>Enter Password: </th>

<td><input type="password" name="txt_password" 

id="password"/></td>

</tr>

<tr>

<td colspan="2" align="center"><input type="submit" 

value="Login" onclick="findLogin()"/></td>

</tr>

</table>

<script language="JavaScript">

function findLogin() {

var unm=document.getElementById("username").value;

var pwd=document.getElementById("password").value;

if(unm == "ANAND" && pwd == "ANAND") {

alert("Login Successfull");

}

else {

document.write("UserName or Password do not match");

}

}

</script>


</body>

</html>


WRITE A JAVASCRIPT TO READ CHARACTER AND PRINT MALE OR FEMALE OR INVALID CHARACTER

 <!DOCTYPE html>

<html>

<body>

<h2> Read a character and print Male or Female based on M or F and otherwise "Invalid Character". </h2>


<table border="2px">

<tr>

<th>Enter character: </th>

<td><input type="text" name="txt_string" id="charecter" maxlength="1" size="1"/></td>

</tr>

<tr>

<td colspan="2" align="center">

<input type="submit" value="click me" onclick="findMale()"/></td>

</tr>

</table>

<script language="JavaScript">

function findMale() {

var ch = document.getElementById("charecter").value;

if(ch == "M" || ch == "m") {

document.write("You have entered: "+ch+" "+"is Male.");

}

else if(ch == "F" || ch == "f") {

document.write("You have entered: "+ch+" "+"is Female.");

}

else {

document.write("You have entered: "+ch+" "+" which is invalid choice.");

}

}

</script>


</body>

</html>


WRITE A JAVASCRIPT TO READ A CHARACTER AND CHECK WHETHER IT IS A VOWEL OR NOT

 <!DOCTYPE html>

<html>

<body>

<h2> Read a character and check whether it is a Vowel or not. </h2>


<table border="2px">

<tr>

<th>Enter character: </th>

<td><input type="text" name="txt_string" id="charecter" maxlength="1" size="1"/></td>

</tr>

<tr>

<td colspan="2" align="center"><input type="submit" value="click me" onclick="findVowel()"/></td>

</tr>

</table>

<script language="JavaScript">

function findVowel() {

var ch = document.getElementById("charecter").value;

if(ch=="A" || ch=="E" || ch=="I" || ch=="O" || ch=="U" || ch=="a" || ch=="e" || ch=="i" || ch=="o" || ch=="u")

{

alert("You have entered: "+ch+" "+"is VOWEL");

}

else {

alert("You have entered: "+ch+" "+"is not VOWEL");

}

}

</script>


</body>

</html>


WRITE A JAVASCRIPT TO CHECK INPUTED STRING IN THAT STRING WHICH IS LARGER OR NOT

 <!DOCTYPE html>

<html>

<body>


<p>Click the button to return the number of characters in the string "Hello World!".</p>

Enter First String: <input type="text" name="txt_fstring" id="first"/> <br/>

Enter Second String: <input type="text" name="txt_sstring" id="second"/> <br/>

<button onclick="myFunction()">Try it</button>


<!--<p id="demo"></p>-->


<script language="JavaScript">

function myFunction() {

  var str = document.getElementById("first").value;

  var str1 = document.getElementById("second").value;

  

  var n = str.length;

  var n1 = str1.length;

  

  //document.getElementById("demo").innerHTML = str +" "+ n +" "+ str1 +" "+ n1;


  if(n > n1) {

document.write("First String is larger than Second");

  }

  else if(n< n1){

document.write("Second String is larger than First");

  }

  else {

document.write("Both are Same");

}

}

</script>


</body>

</html>


WRITE A JAVASCRIPT TO USER ENTERED DATE IS FUTURE DATE OR PAST DATE

 <html>

<head>

<title></title>

</head>

<body>

<h2>Print the day of the month from the system and user entered dates</h2>

Enter Date: <input type="date" name="dt_date" id="dt_date"> <br/>

<input type="submit" value="Click Me" onclick="myFunction()"/>

<script language="JavaScript">

function myFunction() {

var date = new Date();


mydate=new Date(document.getElementById('dt_date').value);


if(date < mydate) {

  alert(" The given date is Future Date");

}

else {

alert("The given date is Past Date");

}

}

</script>

</body>

</html>

WRITE A JAVASCRIPT TO PRINT DAY OF THE MONTH FROM THE SYSTEM AND USER ENTERED DATES

 <html>

<head>

<title></title>

</head>

<body>

<h2>Print the day of the month from the system and user entered dates</h2>

Enter Date: <input type="date" name="dt_date" id="dt_date"> <br/>

<input type="submit" value="Click Me" onclick="myFunction()"/>

<script language="JavaScript">

function myFunction() {

var date=new Date(document.getElementById('dt_date').value);

var day=date.getDate();

var dayname=date.getDay();

if(dayname==1) {

document.write("You have selected: "+date+" "+"Monday");

}

else if(dayname==2) {

document.write("You have selected: "+date+" "+"Tuesday");

}

else if(dayname==3) {

document.write("You have selected: "+date+" "+"Wednesday");

}

else if(dayname==4) {

document.write("You have selected: "+date+" "+"Thursday");

}

else if(dayname==5) {

document.write("You have selected: "+date+" "+"Friday");

}

else if(dayname==6) {

document.write("You have selected: "+date+" "+"Saturday");

}

else {

document.write("You have selected: "+date+" "+"Sunday");

}

}

</script>

</body>

</html>

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>