Web 2016 Old paper Solutions

3rd Semester

2016 Old  paper   

Q.no 12 

javascript function that checks password and retyped password of two different password fields are same
 or not.
<html>
<head>
<title>web</title>
<script type="text/javascript">
function validate(){
var mypwd=document.myform.pwd.value;
var myrpwd=document.myform.rpwd.value;
if(mypwd !=myrpwd) {
alert("password doesn't match");
return false;
}
else{
alert("okay");
return true;
}
}
</script>
</head>
<body>
<form name="myform">
<fieldset>
<legend>Confirm Password</legend>
<label> Password: <input type="password" name="pwd"></label>
<label> Retype-Password: <input type="password" name="rpwd"></label><button onclick="return validate();">Confirm</button>
</fieldset>
</form>
</body>
</html>




14.

Write a JavaScript code to check if a number given by user is prime or not.
<html><head>
<title>Prime check</title>
<script type="text/Javascript">
var a=prompt ("Enter a num: ");
var i, flag1=0; for(i=2; i<a/2;i++)
{
if(a i==0) {
flag1=1; break;
}
}
if(flag1==0) {
document.write (a+" is a a prime number");
}
else {
document.write (a+" is not a prime number"); 0}
</script>
</head>
<body>
</body>
</html>



Q.no 15

Q.no 15
<head>
<title>Form</title>
</head>
<link rel="stylesheet" type="text/css" href="div.css">
</head><body>
<div id="a"> a</div>
<div id="b"> b</div>
<div id="c"> c</div>
<div id="d">d</div>
<body>
</body>
</html>
#a{
width:100px; height:100px; background-color:red; position:relative;
#b{ width:100px; height:100px; background-color:green; position:relative;right:-100px; top:-100px;
#c{ width:100px; height:100px; background-color: white; position:relative;right: 0px;top:-100px;
#d{ width:100px; height:100px; background-color: blue; position:relative;right:-100px;top:-200px;
div {
border-style:solid; border-width:0.05px
}




Leave a Reply

Your email address will not be published.