Ilovepdf Merged
Ilovepdf Merged
Ilovepdf Merged
<html>
<head>
<script>
function openWindow()
</script>
</head>
<body>
<form action="#">
</form>
</body>
</html>
Output:
Code-2:
<html>
<body>
<p>Click the button to open a new window and close the window after three seconds (3000
milliseconds)</p>
<script>
function openWin() {
myWindow.document.write("<p>This is 'myWindow'</p>");
</script>
</body>
</html>
Output:
Code-3:
<!DOCTYPE html>
<html>
<head>
<script>
function myFunction()
myWindow.document.write("<p>This is 'myWin'");
</script>
</head>
<body>
</body>
</html>
Output:
Practical No.12:- Develop a web page for validation of form fields using
regular expressions.
Code-1: Write a JavaScript to test if string contains the letter ‘a’ or ‘c’ or both.
<html>
<body>
<script language="javascript">
re = /[ac]/
if(re.test(input)) {
else {
</script>
</body>
</html>
Output:
Code-2: Develop a program to check for valid email id entered by user.
<html>
<head>
<script>
function checkEmail()
if(!res) {
else {
alert('Thank you')
</script>
</head>
<body>
</form>
</body>
</html>
Output:
Practical No.13: Create a webpage with Rollover effect.
Code-1: JavaScript to create rollover effect for image.
<!doctype html>
<html>
<head>
<script language="javascript">
function MouseRollover(MyImage) {
MyImage.src = "image1.jpg";
function MouseOut(MyImage) {
MyImage.src = "image2.jpg";
</script>
</head>
<body>
<div align="center">
</div>
</body>
</html>
OUTPUT:
2)JavaScript to Create rollover effect for text
<HTML>
<head>
</head>
<Body>
<table>
<tr>
<td>
<a>
</a>
</td>
<td>
<a
onmouseover="document.lang.src='Java.jpg'">
</a>
<br/><br/><br/><br/>
<a
onmouseover="document.lang.src='C++.jpg'">
</a>
<br/><br/><br/><br/>
<br/><br/><br/><br/>
</td>
</tr>
</table>
</body>
</html>
OUTPUT:
3)JavaScript to create rollover effect for text.
<HTML>
<Body>
</body>
</html>
OUTPUT:
Practical.No.14. Develop a webpage for implementing Menus
<html>
<head>
<script>
function displayPage(ch)
page = ch.options[ch.selectedIndex].value
if(page != "")
window.location = page
</script>
</head>
<body>
<option value="https://www.google.com">Google</option>
<option value="https://www.yahoo.com">Yahoo</option>
<option value="https://www.msbte.org.in">MSBTE</option>
</select>
</form>
</body>
</html>
Output:
<html>
<head>
<style>
.menu {
width: 150px;
border-style: solid;
border-width: 1px;
border-color: grey;
position: fixed;
display: none;
.menu-item {
height: 20px;
.menu-item:hover {
background-color: #6CB5FF;
cursor: pointer;
</style>
<script>
function showMenu()
menuBox = window.document.querySelector('.menu')
menuBox.style.display = 'block'
arguments[0].preventDefault()
menuDisplayed = true
function hideMenu()
if(menuDisplayed == true) {
menuBox.style.display = 'none'
}
}
</script>
</head>
<body>
<div class="menu">
<div class="menu-item">Google</div>
<div class="menu-item">Facebook</div>
<hr>
<div class="menu-item">MSN</div>
<div class="menu-item">Bing</div>
</div>
</body>
</html>
Output: