Saturday, 14 September 2024

WRITE A JAVASCRIPT TO PRINT STUDENT MARKSHEET

 


CODE :-

<html>

<head>

<title>Marksheet</title>

<style type="text/css">

body{

background-color:lightblue;

}

.tab{

background-color:lightgreen;

text-transform:capitalize;

font-family:Papyrus;

}

.v1{

text-align:center;

background-color:yellow;

color:purple;

font-weight:bold;

text-transform:uppercase;

font-family:Lucida Handwriting;

}

.v2{

background-color:yellow;

}

</style>

<script type="text/javascript">

function check()

{

var a=document.f1.snm.value;

if(a=="")

{

alert("Student Name Is Empty");

}

var b=document.f1.rno.value;

if(b=="")

{

alert("Student Roll Number Is Empty");

}

var c=parseInt(document.f1.sub1.value);

if(c=="")

{

alert("Subject 1 Is Empty");

}

var d=parseInt(document.f1.sub2.value);

if(d=="")

{

alert("Subject 2 Is Empty");

}

var e=parseInt(document.f1.sub3.value);

if(e=="")

{

alert("Subject 3 Is Empty");

}

var f=parseInt(document.f1.sub4.value);

if(f=="")

{

alert("Subject 4 Is Empty");

}

var g=parseInt(document.f1.sub5.value);

if(g=="")

{

alert("Subject 5 Is Empty");

}

var h=parseInt(document.f1.sub6.value);

if(h=="")

{

alert("Subject 6 Is Empty");

}

var tot=c+d+e+f+g+h;

document.f1.tot.value=tot;

var avg=parseFloat(tot/6.0);

document.f1.avg.value=avg;

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">student marksheet</th>

</tr>

<tr>

<th>student name:-</th>

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

</tr>

<tr>

<th>student roll number:-</th>

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

</tr>

<tr>

<th>subject 1:-</th>

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

</tr>

<tr>

<th>subject 2:-</th>

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

</tr>

<tr>

<th>subject 3:-</th>

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

</tr>

<tr>

<th>subject 4:-</th>

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

</tr>

<tr>

<th>subject 5:-</th>

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

</tr>

<tr>

<th>subject 6:-</th>

<td><input type="text" name="sub6" size="2" 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>total:-</th>

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

</tr>

<tr>

<th>percentage:-</th>

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

</tr>

</table>

</form>

</center>

</body>

</html>



No comments:

Post a Comment