Download as pdf or txt
Download as pdf or txt
You are on page 1of 16

SOURCE CODE:

<html>
<head>
<title>cgpa calculator</title>
<script>
function view(num)
{
document.getElementById("result").value+=num
}
function compute()
{
let x = document.getElementById("result").value
let y = eval(x)
document.getElementById("result").value = y
}
function clr()
{
document.getElementById("result").value = ""
document.getElementById("cgpa").value = ""
}
</script>
<style>
input[type="button"]
{
background-color:grey;
color: black;
border: solid black 2px;
width:100%;
}
input[type="text"]
{
background-color:white;
border: solid black 2px;
width:100%;
}
</style>
</head>
<body>
<center>
<h2>CGPA & Calculator Using JavaScript</h2> <BR>
<table border="0">
<tr>
<td colspan="3"><input type="text" name="result" id="result"/> &nbsp;</td>
<td><input type="button" value="C" onclick="clr()"/> &nbsp;</td>
</tr>
<tr>
<td><input type="button" value="1" onclick="view('1')"/> </td>
<td><input type="button" value="2" onclick="view('2')"/> </td>
<td><input type="button" value="3" onclick="view('3')"/> </td>
<td><input type="button" value="/" onclick="view('/')"/> </td>
</tr>
<tr>
<td><input type="button" value="4" onclick="view('4')"/> </td>
<td><input type="button" value="5" onclick="view('5')"/> </td>
<td><input type="button" value="6" onclick="view('6')"/> </td>
<td><input type="button" value="-" onclick="view('-')"/> </td>
</tr>
<tr>
<td><input type="button" value="7" onclick="view('7')"/> </td>
<td><input type="button" value="8" onclick="view('8')"/> </td>
<td><input type="button" value="9" onclick="view('9')"/> </td>
<td><input type="button" value="+" onclick="view('+')"/> </td>
</tr>
<tr>
<td><input type="button" value="." onclick="view('.')"/> </td>
<td><input type="button" value="0" onclick="view('0')"/> </td>
<td><input type="button" value="=" onclick="compute()"/> </td>
<td><input type="button" value="*" onclick="view('*')"/> </td>
</tr>
<tr>
<td colspan="4">&nbsp;<input type="button" value="CGPA" onclick="cgpa()"/></td>
</tr>
<tr>
<td colspan="4"><input type="text" id="cgpa" name="cgpa" onkeyup="cgpa()"> </td>
</tr>
<script>
function cgpa() {
var result = document.getElementById("result").value;
cgpa=result*100
document.getElementById("cgpa").value=cgpa
//document.write("CGPA Percentage = " + cgpa);
}
</script>
</table>
</center>
</body>
</html>
OUTPUT:
SOURCE CODE:
<html>
<head>
<title>Quiz</title>
<script>
function validate() {
var name = document.forms.RegForm.Name.value;
var pw = document.forms.RegForm.Password.value;
var validName = /\d+$/g;
if (name == "") {
window.alert("Name should not be empty.");
name.focus();
return false;
}
else if(validName.test(name)){
window.alert("Name should be alphabet");
name.focus();
return false;
}
if(pass == "") {
window.alert("Password should not be empty.");
pass.focus();
return false;
}
alert("Login Successfully");
}
</script>
</head>
<body>
<center>
<h1>LOGIN FORM</h1>
<form name="RegForm" onsubmit="return validate()" method="POST"
action="C:\Users\ELCOT\Music\web\quizshare5.html">
<label for="username">Username:</label>
<input type="text" name="name" placeholder="username"/><br><br>
<label for="password">Password:</label>
<input type="password" name="pass" placeholder="password"/><br><br>
<input type="submit" name="login" value="Login"/>
<button type="button" value="cancel">Cancel</button>
</form>
</center>
</body>
</html>

Quizshare5.html:

<html>
<head>
<title>Quiz</title>
</head>
<body>
<center><h1><b><u>QUIZ</u></b></h1></center>
<label><b>Q1.Who is the father of computer? </b></label><br><br>
<input type="radio" name="q1" value="Charles Babbage" id="correct1">Charles
Babbage<br>
<input type="radio" name="q1" value="Einstein">Einstein<br>
<input type="radio" name="q2" value="Sundar piccai">Sundar Piccai<br><br>
<label><b>Q2.WWW stands for?</b></label><br><br>
<input type="radio" name="q2" id="correct2" value="World Wide Web">World Wide
Web<br>
<input type="radio" name="q2" value="World Wide Wares">World Wide Wares<br>
<input type="radio" name="q2" value="World Wide War">World Wide War<br><br>
<label><b>Q3.MS-Word is an example of?</b></label><br>
<input type="radio" name="q3" id="correct3" value="an operating system">an operating
system<br>
<input type="radio" name="q3" value="a processing device">a processing device<br>
<input type="radio" name="q3" value="an input device">an input device<br><br>
<label><b>Q4.Ctrl,Shift and Alt are called ?</b></label><br><br>
<input type="radio" name="q4" value="function">function<br>
<input type="radio" name="q4" value="modifier" id="correct4">modifier<br>
<input type="radio" name="q4" value="adjustment">adjustment<br><br>
<label><b>Q5.Junk e-mail is also called?</b></label><br><br>
<input type="radio" name="q5" value="spoof">spoof<br>
<input type="radio" name="q5" value="spam" id="correct5">spam<br>
<input type="radio" name="q5" value="spool">spool<br><br>
<label><b>Q6.Where is RAM located?</b></label><br><br>
<input type="radio" name="q6" value="mother board" id="correct6">mother board<br>
<input type="radio" name="q6" value="external drive">external drive<br>
<input type="radio" name="q6" value="none">none<br><br>
<label><b>Q7.MICR Stnads for?</b></label><br><br>
<input type="radio" name="q7" value="code">code<br>
<input type="radio" name="q7" value="character" id="correct7">character<br>
<input type="radio" name="q7" value="color">color<br><br>
<label><b>Q8.The Monitor of a computer is?</b></label><br><br>
<input type="radio" name="q8" value="storage device">storage device<br>
<input type="radio" name="q8" value="input device">input device<br>
<input type="radio" name="q8" value="output device" id="correct8">output
device<br><br>
<label><b>Q9.CPU stands for?</b></label><br><br>
<input type="radio" name="q9" value="central process unit" id="correct9">central
process unit<br>
<input type="radio" name="q9" value="control processing unit">control processing
unit<br>
<input type="radio" value="computer processing unit" name="q9">computer processing
unit<br><br>
<label><b>Q10.what is the brain of a computer?</b></label><br><br>
<input type="radio" value="RAM" name="q10">RAM<br>
<input type="radio" value="ROM" name="q10">ROM<br>
<input type="radio" value="CPU" name="q10" id="correct10">CPU<br><br>

<input type="submit" name="submit" value="Submit" onClick="result()"/>

<script type="text/javascript">
function result()
{
var score=0;
if(document.getElementById('correct1').checked)
{
score++;
}
if(document.getElementById('correct2').checked)
{
score++;
}
if(document.getElementById('correct3').checked)
{
score++;
}
if(document.getElementById('correct4').checked)
{
score++;
}
if(document.getElementById('correct5').checked)
{
score++;
}
if(document.getElementById('correct6').checked)
{
score++;
}
if(document.getElementById('correct7').checked)
{
score++;
}
if(document.getElementById('correct8').checked)
{
score++;
}
if(document.getElementById('correct9').checked)
{
score++;
}
if(document.getElementById('correct10').checked)
{
score++;
}
Alert ("Your score is:"+score);
}
</script>
</body>
</html>
OUTPUT:
SOURCE CODE:
<html>
<head>
<title>Quiz</title>
<script>
function validate() {
var name = document.forms.RegForm.Name.value;
var pw = document.forms.RegForm.Password.value;
var validName = /\d+$/g;
if (name == "") {
window.alert("Name should not be empty.");
name.focus();
return false;
}
else if(validName.test(name)){
window.alert("Name should be alphabet");
name.focus();
return false;
}
if(pass == "") {
window.alert("Password should not be empty.");
pass.focus();
return false;
}
alert("Login Successfully");
}
</script>
</head>
<body>
<center>
<h1>LOGIN FORM</h1>
<form name="RegForm" onsubmit="return validate()" method="POST"
action="C:\Users\ELCOT\Music\web\quizshare5.html">
<label for="username">Username:</label>
<input type="text" name="name" placeholder="username"/><br><br>
<label for="password">Password:</label>
<input type="password" name="pass" placeholder="password"/><br><br>
<input type="submit" name="login" value="Login"/>
<button type="button" value="cancel">Cancel</button>
</form>
</center>
</body>
</html>

Quizshare5.html:

<html>
<head>
<title>Quiz</title>
</head>
<body>
<center><h1><b><u>QUIZ</u></b></h1></center>
<label><b>Q1.Who is the father of computer? </b></label><br><br>
<input type="radio" name="q1" value="Charles Babbage" id="correct1">Charles
Babbage<br>
<input type="radio" name="q1" value="Einstein">Einstein<br>
<input type="radio" name="q2" value="Sundar piccai">Sundar Piccai<br><br>
<label><b>Q2.WWW stands for?</b></label><br><br>
<input type="radio" name="q2" id="correct2" value="World Wide Web">World Wide
Web<br>
<input type="radio" name="q2" value="World Wide Wares">World Wide Wares<br>
<input type="radio" name="q2" value="World Wide War">World Wide War<br><br>
<label><b>Q3.MS-Word is an example of?</b></label><br>
<input type="radio" name="q3" id="correct3" value="an operating system">an operating
system<br>
<input type="radio" name="q3" value="a processing device">a processing device<br>
<input type="radio" name="q3" value="an input device">an input device<br><br>
<label><b>Q4.Ctrl,Shift and Alt are called ?</b></label><br><br>
<input type="radio" name="q4" value="function">function<br>
<input type="radio" name="q4" value="modifier" id="correct4">modifier<br>
<input type="radio" name="q4" value="adjustment">adjustment<br><br>
<label><b>Q5.Junk e-mail is also called?</b></label><br><br>
<input type="radio" name="q5" value="spoof">spoof<br>
<input type="radio" name="q5" value="spam" id="correct5">spam<br>
<input type="radio" name="q5" value="spool">spool<br><br>
<label><b>Q6.Where is RAM located?</b></label><br><br>
<input type="radio" name="q6" value="mother board" id="correct6">mother board<br>
<input type="radio" name="q6" value="external drive">external drive<br>
<input type="radio" name="q6" value="none">none<br><br>
<label><b>Q7.MICR Stnads for?</b></label><br><br>
<input type="radio" name="q7" value="code">code<br>
<input type="radio" name="q7" value="character" id="correct7">character<br>
<input type="radio" name="q7" value="color">color<br><br>
<label><b>Q8.The Monitor of a computer is?</b></label><br><br>
<input type="radio" name="q8" value="storage device">storage device<br>
<input type="radio" name="q8" value="input device">input device<br>
<input type="radio" name="q8" value="output device" id="correct8">output
device<br><br>
<label><b>Q9.CPU stands for?</b></label><br><br>
<input type="radio" name="q9" value="central process unit" id="correct9">central
process unit<br>
<input type="radio" name="q9" value="control processing unit">control processing
unit<br>
<input type="radio" value="computer processing unit" name="q9">computer processing
unit<br><br>
<label><b>Q10.what is the brain of a computer?</b></label><br><br>
<input type="radio" value="RAM" name="q10">RAM<br>
<input type="radio" value="ROM" name="q10">ROM<br>
<input type="radio" value="CPU" name="q10" id="correct10">CPU<br><br>

<input type="submit" name="submit" value="Submit" onClick="result()"/>

<script type="text/javascript">
function result()
{
var score=0;
if(document.getElementById('correct1').checked)
{
score++;
}
if(document.getElementById('correct2').checked)
{
score++;
}
if(document.getElementById('correct3').checked)
{
score++;
}
if(document.getElementById('correct4').checked)
{
score++;
}
if(document.getElementById('correct5').checked)
{
score++;
}
if(document.getElementById('correct6').checked)
{
score++;
}
if(document.getElementById('correct7').checked)
{
score++;
}
if(document.getElementById('correct8').checked)
{
score++;
}
if(document.getElementById('correct9').checked)
{
score++;
}
if(document.getElementById('correct10').checked)
{
score++;
}
Alert ("Your score is:"+score);
var
p="https://drive.google.com/drive/folders/169zCP5RxI02aDb5PvrBHaWAc96QVc1_i";
window.open(p)
}
</script>
</body>
</html>
OUTPUT:

You might also like