Professional Documents
Culture Documents
U18CO106
1.write a program to find maximum of 3 nosusing math object(use prompt box for each input).
<script>
inputNumber = 1;
arr[inputNumber] = value;
inputNumber = inputNumber + 1;
</script>
o/p:
2.write a javascript to validate student MIS registration form for SVNIT students. If a blank field is left it should display
an error message.
<html>
<head>
<script>
function valid() {
var name =
document.forms["RegForm"]["Name"];
var what =
document.forms["RegForm"]["Subject"];
var password =
document.forms["RegForm"]["Password"];
return false;
if (name.value == "") {
name.focus();
return false;
}
if (password.value == "") {
password.focus();
return false;
if (what.selectedIndex < 1) {
what.focus();
return false;
return true;
</script>
<style>
div {
box-sizing: border-box;
width: 100%;
float: left;
align-content: center;
align-items: center;
form {
margin: 0 auto;
width: 600px;
}
</style>
</head>
<body>
<br />
<br />
<option>BTECH</option>
<option>MTECH</option>
<option>PHD</option>
</select>
</p>
<br />
<br />
<p>
</p>
</form>
</body>
</html>
3. make a simple interest Calculator using javascript. The result calculated should be displayed in a new window.
<html>
<head>
<title></title>
<script>
function calculate()
p = document.getElementById("p").value;
n = document.getElementById("n").value;
r = document.getElementById("r").value;
win.document.write(result);
}
</script>
</head>
<body>
<button onclick="calculate()">Calculate</button>
<p id="result"></p>
</body>
</html>
4.create home page for SVNIT college displaying amenities of college in an automatic carousel using javascript.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
</head><body>
<div class="slider">
<div id="img">
<img src="e.jpg">
</div>
</div>
<script>
var x = 0;
setInterval(slider, 2000);
function slider() {
if (x < images.length) {
x = x + 1;
} else {
x = 1;
} </script>
<style type="text/css">
.slider {
width: 90%;
height: 500px;
box-sizing: border-box;
overflow: hidden;
} img {
width: 100%;
height: 100%;
@keyframes ani {
0% {
transform: scale(1.2);
10% {
transform: scale(1);
100% {
transform: scale(1);
</style>
</body></html>
5.create one form for taking input via checkbox from user for receiving updates via newsletter for events at
SVNIT.only if user selects to opt for newsletter, display options using checkbox for selecting from events suck as
annual fest, drishti events, student chapters,STTP,summer schools,talks ,conferences,workshops,courses through
NPTEL.Display the selecte choises in a new tab.
<!DOCTYPE html>
<html lang="en">
<head>
<title>Fifth Assignment</title>
</head>
<body>
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
</div>
<br />
<button type="submit">Subscribe</button>
</form>
</body>
<script>
function handleSubmit() {
console.log(form['opt'].value);
res += '<ul>';
document.getElementsByName('choices').forEach((checkbox) => {
if (checkbox.checked) {
res += `<li>${checkbox.value}</li><br>`;
});
res += '</ul>';
} else {
} newWindow.document.write(res);
document.getElementById('hiddenChoices').style.display = 'none';
opt_round_buttons.forEach((rb) =>
rb.addEventListener('change', () => {
console.log(rb.value);
if (rb.value == 'yes') {
document.getElementById('hiddenChoices').style.display = 'block';
} else {
document.getElementById('hiddenChoices').style.display = 'none';
})
);
</script> </html>