Dhiraj Lab
Dhiraj Lab
<!DOCTYPE html>
<html lang=”en”>
<head>
<meta charset=”UTF-8”>
<title>LAB 1</title>
</head>
<body>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Officia esse
earum quae tempore temporibus odit vel cum dignissimos cumque et illo
placeat blanditiis commodi reprehenderit unde veritatis iure nobis molestiae
rerum veniam, beatae saepe? Lorem ipsum dolor sit amet consectetur
adipisicing elit. Impedit accusantium magnam, odit laborum doloremque
excepturi reprehenderit aliquid id perspiciatis eaque architecto eveniet saepe
placeat harum officiis sit, molestias voluptatem obcaecati nemo temporibus
quam in similique? Autem mollitia sunt eos. Fugiat delectus excepturi labore
ea quidem similique laudantium libero aspernatur ipsam.</p>
<audio controls>
<source src=”song.mp3”>
</audio>
<button onclick=”window.print()”>Print</button>
</body>
</html>
Lab 2
<!DOCTYPE html>
<html lang=”en”>
<head>
<meta charset=”UTF-8”>
<title>Form Validation</title>
<style>
</style>
</head>
<h2>Form Validation</h2>
<form id=”registrationForm”>
<label for=”name”>Name:</label>
<button type=”submit”>Submit</button>
</form>
<script>
Document.getElementById(‘registrationForm’).addEventListener(‘submit’,
function(event) {
Event.preventDefault();
return;
return;
return;
// Optionally: document.getElementById(‘registrationForm’).submit(); // If
you want to actually submit the form
});
</script>
</body>
</html>
Lab 3
<!DOCTYPE html>
<html lang=”en”>
<head>
<meta charset=”UTF-8”>
<title>LAB 3</title>
</head>
<body>
<p id=”a”></p>
<h1 id=”zx”>Tanmai</h1>
<p>
</p>
<button onclick=”window.print()”>Print</button>
<script>
Const array=[“one”,”two”,”three”];
Let text= “”;
Document.getElementById(“abc”).innerHTML=text;
Let text1=””
Document.getElementById(“ab”).innerHTML=text1;
Text_Print=””
For(let x of text3)
Text_Print+= x+ “”;
Document.getElementById(“a”).innerHTML=text_Print;
Function change_colour(){
Document.getElementById(“zx”).style.color=”red”;
}
Function onbulb(){
If (button.innerHTML==”On”) {
Bulb.src=”bulbon.png”;
Button.innerHTML=”Off”;
Else
Button.innerHTML=”On”;
Bulb.src=”bulboff.png”;
</script>
</body>
</html>
Lab 4
<!DOCTYPE html>
<html lang=”en”>
<head>
<meta charset=”UTF-8”>
<meta name=”viewport” content=”width=device-width, initial-
scale=1.0”>
<title>LAB 4</title>
</head>
<body>
<label for=”age”>Age</label>
</form> <br>
<button onclick=”window.print()”>Print</button>
<script>
Function submitfrm(){
Let a=document.forms[“frm”][“name”].value;
Let b=document.forms[“frm”][“Age”].value;
Let c=document.forms[“frm”][“phno”].value;
If(a==””){
Window.alert(“Enter Name”);
Return false;
}
Window.alert(“”);
Return false;
Else if(c==””)
Return false;
Else if(d==””)
Window.alert(“Enter Password”);
Return false;
Return true;
</script>
</body>
</html>
Lab 5
<!DOCTYPE html>
<html lang=”en”>
<head>
<meta charset=”UTF-8”>
<title>LAB 5</title>
<style>
#color{
Background-color: aqua;
#inp{
Background-color: aqua;
</style>
</head>
<body>
<h1 id=”color”onmouseover=”colorch(this)”
onmouseout=”colorch2(this)”>Color change</h1>
<div id=”data1”>
</div>
<button onclick=”window.print()”>Print</button>
<script>
Function colorch(col) {
Col.style.backgroundColor=”red”;
Function colorch2(col) {
Col.style.backgroundColor=”aqua”;
Const par=document.createElement(“p”);
Const cld=document.createTextNode(“Tanmai”);
Par.appendChild(cld);
Document.body.appendChild(par);
Const bodypara=document.getElementById(“para2”);
Document.body.insertBefore(par,bodypara);
Const par1=document.getElementById(“data1”);
Const cld1=document.getElementById(“p1”);
Par1.removeChild(cld1);
</script>
</body>
</html>
Lab 6
<!DOCTYPE html>
<html lang=”en”>
<head>
<meta charset=”UTF-8”>
<title>Lab 6</title>
</head>
<body>
<button onclick=”show()”>Show</button>
<button onclick=”hide()”>Hide</button>
<p id=”ab”>Lorem ipsum dolor sit, amet consectetur adipisicing elit. Eum
qui est in, ab saepe voluptate non sint excepturi culpa eos velit? Sequi
recusandae adipisci harum doloribus nesciunt exercitationem. Facere,
accusantium?</p>
<button onclick=”window.print()”>Print</button>
<script>
// function show(){
//
fetch(https://jsonplaceholder.typicode.com/users).then(handleResponse).catc
h((err)=>{console.log(err)});
// }
// function handleResponse(response){
// response.json().then(handleData);
// }
// function handleData(data){
// console.log(data);
// for(let x in data){
// }
// document.getElementById(“ab”).innerHTML=print;
// }
Function hide(){
Fetch(https://jsonplaceholder.typicode.com/Posts,{
Method: “POST”,
Body:JSON.stringify(obj),
Headers:{
“Content-Type”: “application/json;charset=UTF-8”
}).then(handleResponse).catch((err)=>{console.log(err)});
Function handleResponse(response){
Response.json().then(handleData);
}
Function handleData(data){
Console.log(data);
// for(let x in data){
// }
Print= data.name;
Document.getElementById(“ab”).innerHTML=print;
</script>
</body>
</html>
Lab 7
<Bookstore>
<Book category=”html”>
<Author>Tanmai </Author>
<Price>50</Price>
<Year>2015</Year>
</Book>
<Book category=”html”>
<Author>Sanjit</Author>
<Price>50</Price>
<Year>2015</Year>
</Book>
<Book category=”html”>
<Title>"Introduction To HTML"</Title>
<Author>Akash</Author>
<Price>50</Price>
<Year>2015</Year>
</Book>
</Bookstore>
<!—‘’ !apos
<!—“” quot
Lab 8
<Bookstore>
<Book category=”html”>
<Price>50</Price>
<Year>2015</Year>
</Book>
<Book category=”html”>
<Author>Sanjit</Author>
<Price>50</Price>
<Year>2015</Year>
</Book>
<Book category=”html”>
<Title>"Introduction To HTML"</Title>
<Author>Akash</Author>
<Price>50</Price>
<Year>2015</Year>
</Book>
</Bookstore>
<!—‘’ !apos
<!—“” quot
Lab 8