0% found this document useful (0 votes)
5 views5 pages

3rd Assignment

The document contains three sets of web technology assignments focusing on JavaScript and jQuery. Set A includes a script that prompts users about exam preparation and an HTML example that appends text and list items. Sets B and C provide examples of inserting text around an image and removing a div element, respectively, using jQuery.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views5 pages

3rd Assignment

The document contains three sets of web technology assignments focusing on JavaScript and jQuery. Set A includes a script that prompts users about exam preparation and an HTML example that appends text and list items. Sets B and C provide examples of inserting text around an image and removing a div element, respectively, using jQuery.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Assignment no-3 web tech

Set A
Q1 ans
[Link] = function() {
alert("Exams are near, have you started preparing for?");

let response = prompt("Have you started preparing? (Yes/No)");

if (response && [Link]() === "yes") {


alert("Great! Keep it up.");
} else {
let confirmStudy = confirm("Would you like to start preparing now?");
if (confirmStudy) {
alert("Good decision! Start studying now.");
} else {
alert("You should start soon to do well in exams.");
}
}
};

Q2 ans
<!DOCTYPE html>
<html lang="en">
<head>
<title>Append Example</title>
<script src="[Link]
</head>
<body>

<p id="para">This is a paragraph.</p>


<ol id="list">
<li>Item 1</li>
<li>Item 2</li>
</ol>

<button id="addText">Append Text</button>

<script>
$(document).ready(function() {
$("#addText").click(function() {
$("#para").append(" More content added.");
$("#list").append("<li>New List Item</li>");
});
});
</script>

</body>
</html>
Set B
Q2 ans
<!DOCTYPE html>
<html lang="en">
<head>
<title>Insert Text</title>
<script src="[Link]
</head>
<body>

<button id="addText">Insert Text</button>


<br><br>
<img id="myImage" src="[Link]" alt="Sample Image" width="200">

<script>
$(document).ready(function() {
$("#addText").click(function() {
$("#myImage").before("<p>Text Before Image</p>");
$("#myImage").after("<p>Text After Image</p>");
});
});
</script>

</body>
</html>
Set C
Q2 ans
<!DOCTYPE html>
<html lang="en">
<head>
<title>Remove Div</title>
<script src="[Link]
</head>
<body>

<div id="content">
<p>This is a paragraph inside a div.</p>
<button id="removeDiv">Remove Section</button>
</div>

<script>
$(document).ready(function() {
$("#removeDiv").click(function() {
$("#content").remove();
});
});
</script>
</body>
</html>

You might also like