Web - Tech Record
Web - Tech Record
Web - Tech Record
*Frame1 code*
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<img src="http://www.gvpcdpgc.edu.in/gvplogo2021.jpg" width="1500px" height="120px"
position:center>
</body>
</html>
*Frame2 code*
<!DOCTYPE html>
<html>
<head>
<style>
li {
margin-bottom: 10px;
font-weight: bold;
}
</style>
</head>
<body bgcolor="C8A1E0">
<ul>
<li><a href="https://www.geeksforgeeks.org/artificial-intelligence/" target="b">CSM</a></li>
<li><a href="https://www.w3schools.com/html/" target="a">HTML</a></li>
<li><a href="https://www.justdial.com/Mumbai/Tutorials-For-Civil-Engineering/nct-10502616"
target="c">CIVIL</a></li>
<li><a href="https://www.mechanicaltutorial.com/" target="a">/MECH</a></li>
</ul>
</body>
</html>
*Frame3 code*
<html>
<body text="black" bgcolor="#d84a2c ">
<h1>K.V.S MOHITH</h1>
</body>
</html>
*Main Frame code*
<frameset rows="20%,*">
<frame name="fr1" src="Frame1.html">
<frameset cols="25%,*">
<frame name="fr2" src="Frame2.html">
<frame name="fr3" src="frame3.html">
</frameset>
</frameset>
Output:
2.AIM: Left frame has links to Registration page, Login page, Contact us etc.
SOURCE CODE:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Left Frame with Links</title>
</head>
<body style="display: flex; margin: 0; font-family: Arial, sans-serif;">
<div style="width: 200px; background-color: #2596be; padding: 15px; box-shadow: 2px 0 5px
rgba(0, 0, 0, 0.1); height: 100vh;">
<h2>Menu</h2>
<a href="registration.html" style="display: block; color: #333; padding: 10px; text-decoration:
none; margin-bottom: 10px; border-radius: 5px;">Registration Page</a>
<a href="login.html" style="display: block; color: #333; padding: 10px; text-decoration: none;
margin-bottom: 10px; border-radius: 5px;">Login Page</a>
<a href="contact.html" style="display: block; color: #333; padding: 10px; text-decoration: none;
margin-bottom: 10px; border-radius: 5px;">Contact Us</a>
</div>
</body>
</html>
Output:
3.AIM: Login page has username and password fields along with submit
button, forgot password and sign up hyperlinks.
SOURCE CODE:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Login Page</title>
</head>
<body bgcolor='red'>
<div class="form-container">
<form action="#" method="post">
<p align="center">
<label for="username">Username:</label>
<input type="text" id="username" maxlength="30" size="15" required>
</p>
<p align="center">
<label for="password">Password:</label>
<input type="password" id="password" maxlength="10" size="15" required>
</p>
</form>
<p align="center">
<a href="#">Forgot Password?</a><br>
<a href="#">Sign Up</a><br>
<input type="submit" name="s" value="Submit">
</p>
</div>
</body>
</html>
Output:
</head>
<body bgcolor=green align='center'text=white>
<div class="form-container">
<h2>Registration</h2>
<form action="#" method="post">
<p>
<label for="username">Username:</label>
<input type="text" id="username" name="username" maxlength="30">
</p>
<p>
<label for="password">Password:</label>
<input type="password" id="password" name="password" maxlength="10">
</p>
<p>
<label for="confirm-password">Confirm Password:</label>
<input type="password" id="confirm-password" name="confirm-password"
maxlength="10">
</p>
<p>
<label for="email">Email ID:</label>
<input type="email" id="email" name="email" >
</p>
<p>
<label for="mobile">Mobile Number:</label>
<input type="tel" id="mobile" name="mobile" pattern="[0-9]{10}" >
</p>
<p>
<label for="dob">Date of Birth:</label>
<input type="date" id="dob" name="dob" >
</p>
<p>
<label for="address">Address:</label>
<textarea id="address" name="address" rows="4" ></textarea>
</p>
<p>Gender:</p>
<p>
<input type="radio" id="male" name="gender" value="male" >
<label for="male">Male</label>
<input type="radio" id="female" name="gender" value="female">
<label for="female">Female</label>
<input type="radio" id="other" name="gender" value="other">
<label for="other">Other</label>
</p>
<p>
<input type="submit" value="Register">
</p>
</form>
</div>
</body>
</html>
Output:
WEEK-3
CSS(CASCADING STYLE SHEETS)
5.AIM: Apply styles to web pages using inline.
SOURCE CODE:
<html>
<head>
<title>Inline style</title>
</head>
<body bgcolor=#138d75>
<h1 align="center" style="color:black;background-color:#fdfefe">
Inline Style Sheet
</h1>
<hr>
<p>Normal Para graph</p>
<p style="font-size:15pt"><b>WEB TECHNOLOGIES<b></p>
<p style="font-size:25pt"><b>WEB TECHNOLOGIES<b></p>
<p style="font-size:35pt"><b>WEB TECHNOLOGIES<b></p>
</body>
</html>
Output:
.s10 {font-size:40;}
body{background-color:#28b463}
h1 {color:Black;background-color:#abebc6 }
</style>
</head>
<body>
</body>
</html>
Output:
Output:
Week 4 and Week 5:
JAVA SCRIPT:
8. Aim: Create a form similar to the one in previous experiment. Put validation
checks on values entered by the user using JavaScript (such as age should be a
value between 1and 150).
Source code:
<!DOCTYPE html>
<html>
<head>
<title>Registration Page</title>
<script>
// Function to validate the form
function validateForm() {
// Get form values
var username = document.getElementById("username").value;
var password = document.getElementById("password").value;
var confirmPassword = document.getElementById("confirm_password").value;
var email = document.getElementById("email").value;
var mobile = document.getElementById("mobile").value;
var dob = document.getElementById("dob").value;
var gender = document.querySelector('input[name="gender"]:checked');
// Username validation
if (username.trim() === "") {
document.getElementById("usernameError").textContent = "Username is required.";
isValid = false;
}
// Password validation
if (password.length < 10) {
document.getElementById("passwordError").textContent = "Password must be at least 6
characters.";
isValid = false;
}
// Email validation
var emailPattern = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6}$/;
if (!emailPattern.test(email)) {
document.getElementById("emailError").textContent = "Please enter a valid email address.";
isValid = false;
}
// Gender validation
if (!gender) {
document.getElementById("genderError").textContent = "Please select a gender.";
isValid = false;
}
Output:
9. Aim: Write a JavaScript program to display information box as soon as page
loads.
Source code:
<!DOCTYPE html>
<html>
<head>
<title>Information Box</title>
<style>
#infoBox {
position: fixed;
left: 30%;
background-color: #cacfd2 ;
padding: 20px;
text-align: center;
}
#infoBox button {
background-color: #f1c40f;
color: white;
}
</style>
</head>
<body>
<h1>Welcome to the Webpage!</h1>
<!-- Information Box -->
<div id="infoBox">
<h2>Information</h2>
<p>This is an important message!</p>
<button onclick="closeInfoBox()">Close</button>
</div>
<script>
// Function to close the information box
function closeInfoBox() {
document.getElementById("infoBox").style.display = "none";
}
</script>
</body>
</html>
Output:
10. Aim : Write a JavaScript program to change background color after 5
seconds of page load.
Source code:
<html>
<head>
<script>
// Function to change the background color
function changeBackgroundColor() {
// Change the background color to lightgreen
document.body.style.backgroundColor = "yellow";
}
</body>
</html>
Output:
11. Aim : Write a JavaScript program to dynamically bold, italic and underline
words and phrases based on user actions.
Source code:
<!DOCTYPE html>
<html>
<head>
button {
margin: 10px;
padding: 10px;
border-radius: 5px;
}
</style>
</head>
<body>
<script>
// Function to apply bold styling
function applyBold() {
document.execCommand('bold');
}
</body>
</html>
Output:
12. Aim: Write a JavaScript program to display a hidden div (e.g. showing stats
of a player when user clicks on his name).
source code:
<!DOCTYPE html>
<html>
<head>
<title>Player Stats</title>
<style>
/* Hide the stats section by default */
.player-stats {
display: none;;
}
.player-name {
cursor: pointer;
color: green;
}
</style>
</head>
<body text=black>
<h1>Player List</h1>
<!-- List of players -->
<div>
<span class="player-name" onclick="toggleStats('player1')">Player 1</span><br>
<span class="player-name" onclick="toggleStats('player2')">Player 2</span><br>
<span class="player-name" onclick="toggleStats('player3')">Player 3</span><br>
</div>
<!-- Hidden player stats -->
<div id="player1" class="player-stats">
<h2>Player 1 Stats</h2>
<p>Points: 1200</p>
<p>Assists: 350</p>
<p>Rebounds: 500</p>
</div>
<div id="player2" class="player-stats">
<h2>Player 2 Stats</h2>
<p>Points: 1100</p>
<p>Assists: 400</p>
<p>Rebounds: 450</p>
</div>
<div id="player3" class="player-stats">
<h2>Player 3 Stats</h2>
<p>Points: 1300</p>
<p>Assists: 300</p>
<p>Rebounds: 550</p>
</div>
<script>
// JavaScript to toggle visibility of the player's stats div
function toggleStats(playerId) {
// Get the stats div for the clicked player
const statsDiv = document.getElementById(playerId);
// Check if the div is already visible
if (statsDiv.style.display === 'none' || statsDiv.style.display === '') {
statsDiv.style.display = 'block'; // Show the stats
} else {
statsDiv.style.display = 'none'; // Hide the stats
}
}
</script>
</body>
</html>
Output :
13.Aim : Create a webpage that has username and passwors using java script
that gives you error message if the username and passwors doest not match.
Source code:
<html>
<head>
<script language="javascript">
function fun()
{
var s1="vrs";
var s2="yrn";
var s3,s4;
s3=document.f1.t1.value;
s4=document.f1.t2.value;
if((s1==s3)&&(s2==s4))
window.alert("user name and password correct");
else if(!(s1==s3)&&(s2==s4))
window.alert("user name wrong");
else
if((s1==s3)&&!(s2==s4))
window.alert("password wrong");
else
if(!(s1==s3)&&!(s2==s4))
window.alert("both user name and password wrong");
}
</script>
</head>
<body>
<center>
<form name="f1" onsubmit="fun()">
<table border="1">
<tr><td>user name:<td><input type="text" name="t1" size=20></tr>
<tr><td>password:<td><input type="password" name="t2" size=20></tr>
<tr><td colspan=2 align="center"><input type="submit" value="submit"></tr>
</table>
</form>
</center>
</body>
</html>
Output:
SOURCE CODE:
<?php
echo "Hello World!";
?>
OUTPUT:
15.AIM: Perform insert, update, and retrieval and delete a record from
database using php and HTML.
SOURCE CODE:
(i)Creating a table
<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "testdb3";
try {
$conn = new PDO("mysql:host=$servername;dbname=$dbname", $username,
$password);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$sql = "CREATE TABLE student (
id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
firstname VARCHAR(30) NOT NULL,
lastname VARCHAR(30) NOT NULL,
email VARCHAR(50),
reg_date TIMESTAMP
)";
$conn->exec($sql);
echo "Table Student created successfully";
}
catch(PDOException $e)
{
echo $sql . "<br>" . $e->getMessage();
}
$conn = null;
?>
OUTPUT: