0% found this document useful (0 votes)
15 views

css1

xccdcdsfdssfvdsfesfddsfdsfaefssgfrsfefefqefqwdadafasdsadsaasdassdsd

Uploaded by

Yash raundal
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

css1

xccdcdsfdssfvdsfesfddsfdsfaefssgfrsfefefqefqwdadafasdsadsaasdassdsd

Uploaded by

Yash raundal
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

9.

Develop a web page using Intrinsic java function

<!DOCTYPE html>
<html>

<head>
<title> Raundal Yash Suresh Roll no:08 </title>
</head>

<body>
<form name="myform">
roll number :<input type="text" name="roll" />
</br></br>
name<input type="text" name="name" />
</br></br>
<img src="12.webp"
onclick="javascript:doocument.form.myform.submit()" />
</br></br>
</form>
</body>
</html>
*************************************************************************************
10. Develop a webpage for creating session and persistent
cookies Observe the effects with browser cookie settings.

<!DOCTYPE html>
<html>
<head>
<title>Raundal Yash Suresh Roll no:08</title>
</head>
<body>
<h1>Cookie</h1>

<button onclick="setSessionCookie()">Set Session Cookie</button>


<button onclick="setPersistentCookie()">Set Persistent Cookie (1
hour)</button>
<button onclick="deleteCookies()">Delete Cookies</button>

<h2>Cookies:</h2>
<pre id="cookiesOutput"></pre>

<button onclick="checkCookies()">Check Cookies</button>

<script>
function setSessionCookie() {
document.cookie = "sessionCookie=Session; path=/";
alert("Session cookie set!");
}

function setPersistentCookie() {
const expires = new Date(Date.now() +3600000).toUTCString();
// 1 hour from now
document.cookie = `persistentCookie=Persistent;
expires=${expires}; path=/`;
alert("Persistent cookie set!");
}
function deleteCookies() {
document.cookie = "sessionCookie=; expires=Thu, 01 Jan 1970
00:00:00 UTC; path=/;";
document.cookie = "persistentCookie=; expires=Thu, 01 Jan
1970 00:00:00 UTC; path=/;";
alert("All cookies deleted!");
checkCookies();
}

function checkCookies() {
document.getElementById("cookiesOutput").textContent =
document.cookie || "No cookies found";
}
</script>
</body>
</html>
**********************************************************
11. Develop a webpage for placing the window on the screen
and working with child window.

<!DOCTYPE>
<html >
<head>
<title>Raundal Yash Suresh Roll no:08</title>
</head>
<body>
<h1>Open Child Window</h1>
<button id="openWindow">Open Child Window</button>

<script>
document.getElementById('openWindow').addEventListener('click'
, () => {
const x = 100; // X position
const y = 100; // Y position

const childWindow = window.open('', 'Child Window',


`width=400,height=300,left=${x},top=${y}`);
if (childWindow) {
childWindow.document.write(`
<html>
<head>
<title>Child Window</title>
</head>
<body>
<h1>This is a Child Window</h1>
<button onclick="window.close()">Close</button>
</body>
</html>
`);
childWindow.document.close();
}
});
</script>
</body>
</html>

**********************************************************
12. Develop a web page for validation of form fields using
regular expressions.
<!DOCTYPE html>
<html>

<head>
<title>Raundal Yash Roll No:08</title>
<script type="text/javascript">
function TestString(str) {
re = /[az]/
if (re.test(str)) {
alert("The letter a or z or both are present in the string");
}
else {
alert("string done not contain a or z or both");
}
}
</script>
</head>

<body>
<h2>Example of Regular Expression</h2>
<script type="text/javascript">
var input_str = prompt("Enter Some string here")
TestString(input_str);
</script>
</body>

</html>
*************************************************************************************

You might also like