css exps
css exps
<head>
</head>
<body>
<script type="text/javascript">
var number = 7;
if (number>5){
if(number %2==0){
} else {
switch(fruit){
case 'banana':fruit
break;
case'apple':
break;
default:
document.write('unknown fruit.<br>');
break;
</script>
</body>
</html>
<html lang="en">
<head>
<title>Array Operations</title>
</head>
<body>
<h1>Array Operations</h1>
<button onclick="pushElement()">Push</button>
<button onclick="popElement()">Pop</button>
<button onclick="shiftElement()">Shift</button>
<button onclick="reverseArray()">Reverse</button>
<button onclick="sortArray()">Sort</button>
<h2>Array:</h2>
<script>
function updateDisplay() {
function pushElement() {
if (input) {
myArray.push(input);
updateDisplay();
document.getElementById('elementInput').value = '';
} else {
function popElement() {
if (myArray.length > 0) {
} else {
alert('Array is empty!');
function shiftElement() {
if (myArray.length > 0) {
updateDisplay();
} else {
alert('Array is empty!');
function reverseArray() {
myArray.reverse();
updateDisplay();
function sortArray() {
myArray.sort();
updateDisplay();
</script>
</body>
</html>
<html>
<head>
</head>
<body>
<script>
document.write("Hello " + name + ", You are " + age + " years old <br>");
greet("Bob", 45);
function addnumbers(a, b) {
return a + b;
// Different values
</script>
</body>
</html>
<html>
<body>
<form action="">
<input type="reset">
<br>
</form>
</body>
</html>
<head>
<script type="text/javascript">
function sayhello() {
function myfunction () {
elmnt.style.color = clr;
</script>
</head>
<body>
<form>
</p>
<p id="demo"></p>
</h1>
</p>
</form>
</body>
</html>
EXP 8:- reate a webpage to implement Form Events.(
<html>
<head>
<script>
function myfunction() {
function myfunction1() {
var x = document.getElementById("tname");
x.value = x.value.toUpperCase();
function myfunction2() {
</script>
</head>
<body>
</body>
</html>
<html>
<head>
<script type="text/javascript">
alert("Form
Submitted
succesfully");
</script>
</head>
<body>
<form name="myform">
<br><br/>
</body>
</html>
<html lang="en">
<head>
</head>
<body>
<div class="container">
<h1>Cookie Manager</h1>
<input type="number" id="cookie-expiry" placeholder="Enter expiry days (leave empty for session cookie)">
</div>
<script>
function setCookie() {
if (!name || !value) {
return;
if (expiryDays) {
cookieString += `expires=${date.toUTCString()};`;
document.cookie = cookieString;
function getCookies() {
function deleteCookie() {
if (!name) {
</script>
</body>
</html>
Exp 11:- Develop a webpage for placing the Window on the screen and working with child
window.(p
<!DOCTYPE html>
<html lang="en">
<head>
</head>
<body>
<div class="container">
function moveWindow() {
window.moveTo(200, 200);
function openChild() {
return;
childWindow.document.write(`
<html>
<head><title>Child Window</title></head>
<body>
<h1>Child Window</h1>
<script>
function sendMessageToParent() {
</script>
</body>
</html>
Exp 12:- Develop a webpage for validation of form fields using regular expressions
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Form Validation</title>
<style>
body {
background-color: #f4f4f9;
color: #333;
margin: 20px;
.container {
max-width: 600px;
margin: auto;
padding: 20px;
background: #fff;
border-radius: 8px;
input {
padding: 10px;
margin: 10px 0;
border-radius: 4px;
font-size: 16px;
button {
padding: 10px;
background-color: #28a745;
color: white;
border: none;
cursor: pointer;
width: 100%;
font-size: 16px;
border-radius: 4px;
button:hover {
background-color: #218838;
}
.error {
color: red;
font-size: 14px;
.success {
color: green;
font-size: 16px;
</style>
</head>
<body>
<div class="container">
<h1>Form Validation</h1>
<form id="validationForm">
<label for="email">Email:</label>
</form>
</div>
<script>
// Validation function
function validateForm() {
if (!nameRegex.test(name)) {
isValid = false;
} else {
nameError.textContent = "";
// Email validation
if (!emailRegex.test(email)) {
isValid = false;
} else {
emailError.textContent = "";
// Phone validation
if (!phoneRegex.test(phone)) {
isValid = false;
} else {
phoneError.textContent = "";
// Password validation
if (!passwordRegex.test(password)) {
passwordError.textContent =
isValid = false;
} else {
passwordError.textContent = "";
// Form Message
if (isValid) {
} else {
formMessage.textContent = "";
</script>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Menu Example</title>
</head>
<body>
<ul class="menu">
<li><a href="#">Home</a></li>
<li>
<a href="#">About</a>
<ul class="dropdown">
<li><a href="#">Team</a></li>
<li><a href="#">History</a></li>
<li><a href="#">Vision</a></li>
</ul>
</li>
<li>
<a href="#">Services</a>
<ul class="dropdown">
<li><a href="#">SEO</a></li>
<li><a href="#">Marketing</a></li>
</ul>
</li>
</ul>
</body>
</html>
<html lang="en">
<head>
</head>
<body>
<div class="slideshow-container">
<div class="slide">
</div>
<div class="slide">
</div>
<div class="slide">
</div>
</div>
</div>
<script>
let currentIndex = 0;
// Initialize Slideshow
showSlide(currentIndex);
function showSlide(index) {
slides[currentIndex].style.display = 'block';
dots[currentIndex].classList.add('active');
// Change Slide
function changeSlide(step) {
currentIndex += step;
showSlide(currentIndex);
function currentSlide(index) {
currentIndex = index - 1;
showSlide(currentIndex);
// Auto Slide
setInterval(() => {
changeSlide(1);
</script>
</body>
</html>