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

Java Site

Java sample project

Uploaded by

km2zgxtfsc
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)
2 views

Java Site

Java sample project

Uploaded by

km2zgxtfsc
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
You are on page 1/ 3

1.

Write a program to create a web site of 3 pages for School with appropriate
data and use CSS.

<!DOCTYPE html>
<html>
<head>
<3tle>School Website</3tle>
<link rel="stylesheet" type="text/css" href="styles.css">
</head>
<body>
<header>
<h1>Welcome to ABC School</h1>
<nav>
<ul>
<li><a href="index.html">Home</a></li>
<li><a href="about.html">About Us</a></li>
<li><a href="contact.html">Contact Us</a></li>
</ul>
</nav>
</header>
<main>
<sec3on>
<h2>Our Vision</h2>
<p>We strive to impart quality educa3on...</p>
</sec3on>
</main>
<footer>
<p>© 2024 ABC School</p>
</footer>
</body>
</html>

CSS (styles.css):
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background-color: #f4f4f4;
}

header {
background-color: #333;
color: white;
padding: 10px 0;
}

header h1 {
text-align: center;
}

nav ul {
list-style-type: none;
text-align: center;
}

nav ul li {
display: inline;
margin-right: 20px;
}

nav ul li a {
color: white;
text-decora3on: none;
}

footer {
text-align: center;
padding: 10px;
background-color: #333;
color: white;
}

2. Write a JavaScript program to calculate multiplication and division of two


numbers (input from user)

<!DOCTYPE html>
<html>
<head>
<3tle>Mul3plica3on and Division</3tle>
</head>
<body>
<h1>Mul3ply or Divide Two Numbers</h1>
<form>
1st Number: <input type="text" id="num1"><br><br>
2nd Number: <input type="text" id="num2"><br><br>
<buaon type="buaon" onclick="mul3ply()">Mul3ply</buaon>
<buaon type="buaon" onclick="divide()">Divide</buaon>
</form>
<p>The Result is: <span id="result"></span></p>

<script>
func3on mul3ply() {
var num1 = document.getElementById('num1').value;
var num2 = document.getElementById('num2').value;
var result = num1 * num2;
document.getElementById('result').innerHTML = result;
}

func3on divide() {
var num1 = document.getElementById('num1').value;
var num2 = document.getElementById('num2').value;
if (num2 != 0) {
var result = num1 / num2;
document.getElementById('result').innerHTML = result;
} else {
document.getElementById('result').innerHTML = 'Cannot divide by zero';
}
}
</script>
</body>
</html>

3. Write a JavaScript program to check whether a given positive number is a


multiple of 3 or a multiple of 7.
<!DOCTYPE html>
<html>
<head>
<3tle>Mul3ple of 3 or 7</3tle>
</head>
<body>
<h1>Check if a Number is a Mul3ple of 3 or 7</h1>
<form>
Enter a Number: <input type="text" id="num"><br><br>
<buaon type="buaon" onclick="checkMul3ple()">Check</buaon>
</form>
<p>Result: <span id="result"></span></p>

<script>
func3on checkMul3ple() {
var num = document.getElementById('num').value;
if (num % 3 == 0 || num % 7 == 0) {
document.getElementById('result').innerHTML = num + ' is a mul3ple of 3 or 7';
} else {
document.getElementById('result').innerHTML = num + ' is not a mul3ple of 3 or 7';
}
}
</script>
</body>
</html>

You might also like