Professional Documents
Culture Documents
Q1. Write an HTML code to process placement registration form which accepts the student
details like name, address, email-id, contact number, date of birth, percentage, branch (must be
selected using radio button) and technology-preferred (using checkbox). Write the JavaScript
code to validate the following i. valid email id (@ and .) ii, all the fields must be filled before
submission of the form. iii percentage validation is minimum first class (=> 60%).
Solution
In this program, I have written code of an HTML document and also an internal javascript added
in that. It shows the user a form with fields name, address, email-id, contact number, date of
birth, percentage, branch (must be selected using radio button) and technology-preferred (using
checkbox)
Code
<html>
<title>
</title>
<script> function validateform(){ var name =
document.studentform.name.value; var address =
document.studentform.address.value; var email =
document.studentform.email.value; var contact =
document.studentform.contact.value; var dob =
document.studentform.dob.value;
var percentages =
document.studentform.percentage.value; var branch =
document.studentform.branch.value; var tech =
document.studentform.tech.value;
if (name == "" || address == "" || email == "" || contact == "" || dob == "" || percentage
== "" || branch == "")
{
/*const element = document.getElementById("div1"); const
msg = document.createElement("p"); const node =
document.createTextNode("Please fill all fields");
msg.appendChild(node); element.replaceChild(msg);*/
alert("Please fill all fields");
} else if (!email.includes("@") || !
email.includes(".") )
{ alert("Invalid Email");
}
</script>
<body>
<h2>Form</h2>
</div>
</body>
</html>
Output
Q2. .Write a HTML5 code for embedding audio & video elements in web page.
In this program I have embedded both audio and video files using HTML 5
Code
<!DOCTYPE html>
<html>
<body>
<div>
<video width="320" height="240" controls autoplay muted>
<source src="https://cdn.videvo.net/videvo_files/video/free/2021-
04/small_watermarked/210329_
06B_Bali_1080p_013_preview.webm" type="video/webm">
Your browser does not support the video tag.
</video>
<br>
<audio controls>
<source
src="https://content.videvo.net/videvo_files/audio/premium/audio0181/originalContent/T
h e-Lark-From-Children's-Album-CLM0111.mp3" type="audio/mp3">
Output
Q3. Write an external stylesheet and link it with HTML code. The stylesheet should include the
following The web page will have the background image "img1.jpg". ii. The table headings will
have red background color. iii. Background color of alternate paragraphs are different. iv. The
hyperlinks on the web page will not have underline.
Code
question3.html
<!DOCTYPE html>
<html>
<head>
</head>
<link rel="stylesheet" href="styles.css">
<body>
<h2>My Table</h2>
<p></p>
<table>
<tr>
<th>Subject</th>
<th>Marks Scored</th>
<th>Grade</th>
</tr>
<tr>
<td>Physics</td>
<td>87</td>
<td>A</td>
</tr>
<tr>
<td>Chemistry</td>
<td>74</td>
<td>C+</td>
</tr>
<tr>
<td>Maths</td>
<td>80</td>
<td>B</td>
</tr>
<tr>
<td>Computers</td>
<td>98</td>
<td>A+</td>
</tr>
</table>
<b>
<a href = "https://www.google.com/"> Link 1 </a><br>
<a href = "https://www.yahoo.com/"> Link 2 </a><br>
<a href = "localhost:3000"> Link 3 </a>
</b>
</body>
</html>
styles.css body {
background-image: url("img1.jpg"); color
: white;
font-family: Verdana, sans-serif;
} table
{
border-collapse:
collapse; width: 100%;
color : black;
}
th, td {
text-align: left;
padding: 8px;
} th{ background-
color:red;
}
a{
font-size : 50px; text-
decoration: none; color :
white;
}
Output