html body { margin-top: 50px !important; } #top_form { position: fixed; top:0; left:0; width: 100%; margin:0; z-index: 2100000000; -moz-user-select: none; -khtml-user-select: none; -webkit-user-select: none; -o-user-select: none; border-bottom:1px solid #151515; background:#FFC8C8; height:45px; line-height:45px; } #top_form input[name=url] { width: 550px; height: 20px; padding: 5px; font: 13px "Helvetica Neue",Helvetica,Arial,sans-serif; border: 0px none; background: none repeat scroll 0% 0% #FFF; }

Registration Form





0% found this document useful (0 votes)
134 views43 pages

Hardik

Here is the HTML code to create a form with fields for Name, Email, Mobile Number, Gender and File Upload: <html> <head> <title>Registration Form</title> </head> <body> <h1>Registration Form</h1> <form action="" method="post"> <label for="name">Name:</label> <input type="text" id="name"><br><br> <label for="email">Email:</label> <input type="email" id="email"><br><br> <label for="mobile">Mobile Number:</label> <input type="text" id="mobile

Uploaded by

Hardik Pampaniya
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)
134 views43 pages

Hardik

Here is the HTML code to create a form with fields for Name, Email, Mobile Number, Gender and File Upload: <html> <head> <title>Registration Form</title> </head> <body> <h1>Registration Form</h1> <form action="" method="post"> <label for="name">Name:</label> <input type="text" id="name"><br><br> <label for="email">Email:</label> <input type="email" id="email"><br><br> <label for="mobile">Mobile Number:</label> <input type="text" id="mobile

Uploaded by

Hardik Pampaniya
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/ 43

Refreshing JavaScript and CSS

Practical 1
Aim: Design web pages of your department with an attractive background
color , text color , an images , font etc.(use external CSS).

Sol:
Index.html:

<!DOCTYPE html>

<html>

<head>

<title>College IT Department</title>

<link rel="stylesheet" type="text/css" href="index.css">

</head>

<body>

<header>

<h1>Gec Gandhinagar IT Department</h1>

<nav>

<ul>

<li><a href="#">Home</a></li>

<li><a href="#">About</a></li>

<li><a href="#">Courses</a></li>

<li><a href="#">Facilities</a></li>

<li><a href="#">Contact Us</a></li>

</ul>

</nav>

</header>

<main>
<section>

<h2>About Us</h2>

<p>

Established in 2004, Government Engineering College, Gandhinagar (GEC-Gn) takes


pride in its highly motivated students. Our students are life-long assets that help this institute
to continuously evolve and work towards its Vision. Approved by AICTE. The College is
administrated by Directorate of Technical Education, Gujarat State, Gandhinagar. GEC Gn is
affiliated to Gujarat Technological University. GEC-Gn offers its students a wide range of
courses to choose from. This helps them to become multi-skilled personalities who can
handle the challenges that industry and society will pose before them as future engineers.
Committed, to deliver excellence in everything that it does, our institute works towards
reducing the gap between industry and education. GEC-Gn endeavors to educate its students
in a manner that offers them an opportunity not only to excel in academics but to be
completely aware of their future industrial needs for professional expertise through
innovative and flexible curriculum. This trains the students of this campus to reach their
highest potential. The highly dedicated faculty members of GEC-Gn are experts in their
professional fields. Their professional skills and industry linkages help the students by
grooming them to become competent engineers who will contribute to the society and
economy in the long run.

</p>

</section>

<section>

<h2>Courses</h2>

<ul>

<li>Introduction to Programming</li>

<li>Web Design and Development</li>

<li>Database Management</li>

<li>Computer Networks</li>

</ul>

</section>

<section>

<h2>Facilities</h2>

<p>Our IT department is equipped with state-of-the-art facilities including:</p>


<ul>

<li>Computer labs with high-speed internet</li>

<li>Latest software and hardware</li>

<li>Projectors and smart boards for interactive learning</li>

</ul>

</section>

</main>

<footer>

<p>&copy; 2023 College IT Department</p>

</footer>

</body>

</html>

Index.css

body {

font-family: Arial, sans-serif;

margin: 0;

padding: 0;

header {

background-color: #333;

color: #fff;

display: flex;

justify-content: space-between;

padding: 1em;

nav ul {

display: flex;
list-style: none;

margin: 0;

padding: 0;

nav li {

margin-left: 1em;

nav a {

color: #fff;

text-decoration: none;

nav a:hover {

text-decoration: underline;

/* Main content styles */

main {

padding: 2em;

section {

margin-bottom: 2em;

}
OUTPUT:-

Practical 2
Aim: Cerate HTML page with javascript which takes Integer
number as input and tells whether the number is ODD or EVEN.
Index.html
<html>

<head>

<script>

var num, temp;

function fun()

num = parseInt(document.getElementById("num").value);

if(num)

temp = document.getElementById("cont");

temp.style.display = "block";

if(num%2==0)

document.getElementById("res").innerHTML = "Even";

else

document.getElementById("res").innerHTML = "Odd";

</script>

</head>

<body>

<p>Enter valid Number: <input id="num"><button onclick="fun()">Check</button></p>


<p id="cont" style="display:none;">It is an <span id="res"></span> Number</p>

</body>

</html>

OUTPUT:-
Practical 3
Aim: Write a javascript program to check number is prime or
not.
primeNum.html
<!DOCTYPE html>

<html>

<head>

<title>

Check a number is Prime or

not using JavaScript

</title>

<script type="text/javascript">

function check(p){

for(let i = 3; i <= Math.sqrt(p); i+=2)

if (p % i === 0) {

return true ;

return false;

// Function to check prime number

function p() {

var n;

// Getting the value form text

// field using DOM

n = document.myform.n.value;

n = parseInt(n)
// Check and display alert message

if( n % 2 === 0 )

alert(n + " is not prime");

else if(check(n))

alert(n + " is not prime");

else

alert(n + " is prime");

</script>

</head>

<body>

<center>

<form name="myform">

Enter the number:

<input type="text" name=n value="">

<br><br>

<input type="button" value="Check" onClick="p()">

<br>

</form>

</center>

</body>

</html>

Output:-
Practical 4
Aim: Write a program to create a simple calculator using
javascript.
index.html
<!DOCTYPE html>

<html lang="en">

<head>

<meta charset="UTF-8">

<meta http-equiv="X-UA-Compatible" content="IE=edge">

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>Calculator</title>

<link href="style.css" rel="stylesheet" type="text/css"/>

<link href="util.css" rel="stylesheet" type="text/css"/>

</head>

<body>

<h1 class="text-center" style="background-color: gold;"><u>Welcome To Vivek's


Calculator</u></h1>

<div class="container flex flex-col item-center bg-black mx-auto">

<div class="row">

<input class="input" type="text"/>

</div>

<div class="row">

<button class="button">M+</button>

<button class="button">M-</button>

<button class="button">00</button>

<button class="button" style="background-color: green;">AC</button>

</div>

<div class="row">
<button class="button">7</button>

<button class="button">8</button>

<button class="button">9</button>

<button class="button">*</button>

</div>

<div class="row">

<button class="button">4</button>

<button class="button">5</button>

<button class="button">6</button>

<button class="button">/</button>

</div>

<div class="row">

<button class="button">1</button>

<button class="button">2</button>

<button class="button">3</button>

<button class="button">+</button>

</div>

<div class="row">

<button class="button">0</button>

<button class="button">.</button>

<button class="button">-</button>

<button class="button" style="background-color: gold;">=</button>

</div>

</div>

<script src="script.js"></script>

</body>
</html>

script.js
let string = "";

let buttons = document.querySelectorAll('.button');

Array.from(buttons).forEach((button)=>{

button.addEventListener('click',(e)=>{

if(e.target.innerHTML == '='){

string = eval(string);

document.querySelector('input').value = string;

else if(e.target.innerHTML == 'AC'){

string = " "

document.querySelector('input').value = string;

else

console.log(e.target)

string = string + e.target.innerHTML;

document.querySelector('input').value = string;

})

})
Style.css
html,body{

height:100%;

width:100%;

.button{

padding:20px;

margin:0 3px;

border: 2px solid gray;

border-radius: 7px;

width: 52px;

.row{

margin:8px 0px;

util.css
.text-center{

text-align: center;

.bg-black{

background-color: black;

.mx-auto{
margin:auto;

.flex{

display:flex;

.flex-col{

flex-direction:column;

.item-center{

align-items: center;

.row input{

font-size: 21px;

padding:18px 0px;

margin:5px;

border: 2px solid gray;

border-radius: 7px;

}
OUTPUT:-

Practical 5
Aim: Create HTML page that contains from with fields Name,Email,Mobile
No, Gender, Favorite Color and button. Write a javascrpt code to combine and
display the information in textbox when the button is clicked.

Sol:
<!DOCTYPE html>

<html>

<head>

<title>Form Example</title>

</head>

<body>

<form>

<label for="name">Name:</label>

<input type="text" id="name" name="name"><br>

<label for="email">Email:</label>

<input type="email" id="email" name="email"><br>

<label for="mobile">Mobile Number:</label>

<input type="tel" id="mobile" name="mobile"><br>

<label for="gender">Gender:</label>

<select id="gender" name="gender">

<option value="male">Male</option>

<option value="female">Female</option>

<option value="other">Other</option>

</select><br>
<label for="color">Favorite Color:</label>

<input type="color" id="color" name="color"><br>

<button type="button" onclick="displayInfo()">Submit</button>

</form>

<textarea id="result" rows="5" cols="50"></textarea>

<script>

function displayInfo() {

const name = document.getElementById('name').value;

const email = document.getElementById('email').value;

const mobile = document.getElementById('mobile').value;

const gender = document.getElementById('gender').value;

const color = document.getElementById('color').value;

const info = `Name: ${name}\nEmail: ${email}\nMobile Number:


${mobile}\nGender: ${gender}\nFavorite Color: ${color}`;

document.getElementById('result').value = info;

</script>

</body>

</html>

output:-
Practical 6
Aim:Write a javascript program to create user defined object car with
carModelname , carColor , carPrice , carSpeed properties and with
displaySpeed(s) , increaseSpeed(s) and DescreaseSpeed(s) as methods.

Sol:
<!DOCTYPE html>

<html lang="en">

<head>

<meta charset="UTF-8" />

<meta http-equiv="X-UA-Compatible" content="IE=edge" />

<meta name="viewport" content="width=device-width, initial-scale=1.0" />

<title>Document</title>

</head>

<body>

<script>

// Define the Car object constructor

function Car(carModelName, carColor, carPrice, carSpeed) {

this.carModelName = carModelName;

this.carColor = carColor;

this.carPrice = carPrice;

this.carSpeed = carSpeed;

// Define the displaySpeed method

this.displaySpeed = function (s) {


this.carSpeed = s;

document.write(`Current speed: ${this.carSpeed} <br/>`);

};

// Define the increaseSpeed method

this.increaseSpeed = function (s) {

this.carSpeed += s;

document.write(

`Speed increased by ${s}. Current speed: ${this.carSpeed} <br/>`

);

};

// Define the decreaseSpeed method

this.decreaseSpeed = function (s) {

if (this.carSpeed - s >= 0) {

this.carSpeed -= s;

document.write(

`Speed decreased by ${s}. Current speed: ${this.carSpeed} <br/>`

);

} else {

document.write(

`Speed cannot be decreased by ${s}. Current speed: ${this.carSpeed} <br/>`

);

};

}
// Create a new Car object

const myCar = new Car("Honda Civic", "Silver", 22000, 0);

// Call the methods on the Car object

myCar.displaySpeed(10); // Output: "Current speed: 0"

myCar.increaseSpeed(20); // Output: "Speed increased by 20. Current speed: 20"

myCar.decreaseSpeed(10); // Output: "Speed decreased by 10. Current speed: 10"

// myCar.decreaseSpeed(15); // Output: "Speed cannot be decreased by 15. Current speed:


10"

</script>

</body>

</html>
output:-

Angular Js Practical
Practical 1
Aim: Design Order Form With total price updated in real time, which contains
name of the five products and their prices. Create a bill amount for all the
products and calculate GST on the billing amount and display total amount.

Sol:
<!DOCTYPE html>

<html ng-app="orderForm">

<head>

<title>Order Form</title>

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.8.2/angular.min.js"></script>

</head>

<body ng-controller="OrderCtrl">

<h1>Order Form</h1>

<form>

<table>

<tr>

<th>Product Name</th>

<th>Price (INR)</th>

<th>Quantity</th>

<th>Total (INR)</th>

</tr>

<tr ng-repeat="product in products">

<td>{{ product.name }}</td>

<td>{{ product.price }}</td>

<td><input type="number" ng-model="product.quantity" ng-


change="calculateTotal()"></td>

<td>{{ product.total }}</td>

</tr>

<tr>

<td colspan="3">Subtotal (INR)</td>

<td>{{ subtotal }}</td>

</tr>
<tr>

<td colspan="3">GST (18%)</td>

<td>{{ gst }}</td>

</tr>

<tr>

<td colspan="3"><strong>Total (INR)</strong></td>

<td><strong>{{ total }}</strong></td>

</tr>

</table>

</form>

<script>

var app = angular.module('orderForm', []);

app.controller('OrderCtrl', function($scope) {

$scope.products = [

{ name: 'Product 1', price: 100 },

{ name: 'Product 2', price: 200 },

{ name: 'Product 3', price: 300 },

{ name: 'Product 4', price: 400 },

{ name: 'Product 5', price: 500 }

];

$scope.calculateTotal = function() {

$scope.subtotal = 0;

angular.forEach($scope.products, function(product) {

product.total = product.price * product.quantity;

$scope.subtotal += product.total;

});
$scope.gst = $scope.subtotal * 0.18;

$scope.total = $scope.subtotal + $scope.gst;

};

$scope.calculateTotal();

});

</script>

</body>

</html>

Output:
Practical 2
Aim: Implement Angular JS to create your Resume.
Sol:
<!DOCTYPE html>

<html ng-app="resumeApp">

<head>

<title>My Resume</title>

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.8.2/angular.min.js"></script>

</head>

<body ng-controller="ResumeCtrl">

<h1>{{ name }}</h1>

<h2>Contact Information</h2>

<ul>

<li>Email: {{ email }}</li>

<li>Phone: {{ phone }}</li>

<li>Address: {{ address }}</li>

</ul>

<h2>Education</h2>
<div>

<h3>10th board</h3>

<ul>

<li>Eklavaya School</li>

<li>Percentage:82</li>

</ul>

</div>

<div>

<h3>12th board</h3>

<ul>

<li>Empirial Science High School</li>

<li>Percentage:86</li>

</ul>

</div>

<div>

<h3>College</h3>

<ul>

<li>Government Engineering College,Gandhinagar</li>

<li>CPI:7</li>

</ul>

</div>

<h2>Work Experience</h2>

<ul>

<li ng-repeat="job in jobs">

<h3>{{ job.title }}, {{ job.company }}</h3>

<p>{{ job.startDate }} - {{ job.endDate }}</p>

<ul>
<li>{{ job.description }}</li>

</ul>

</li>

</ul>

<h2>Skills</h2>

<ul>

<li ng-repeat="skill in skills">{{ skill }}</li>

</ul>

<script>

var app = angular.module('resumeApp', []);

app.controller('ResumeCtrl', function ($scope) {

$scope.name = 'Hardik Pampaniya';

$scope.email = 'ahirhardikpampaniya58@gmail.com';

$scope.phone = '7984612246';

$scope.address = 'Sutarapada';

$scope.jobs = [

title: 'Intern',

company: 'Tatvasoft',

startDate: 'Feb 2023',

endDate: 'May 2023',

description: 'Designed and developed dynamic and responsive websites using HTML,
CSS, JavaScript,reactJs.'

];

$scope.skills = ['JavaScript', 'AngularJS', 'Node.js', 'MongoDB', 'HTML', 'CSS'];

});
</script>

</body>

</html>

Output:
Practical 3
Aim: Use Practical No.01 and initialize prices to 0 when form loads. (use
module, controller & directive)

Sol:
<!DOCTYPE html>

<html ng-app="orderForm">

<head>

<title>Order Form</title>

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.8.2/angular.min.js"></script>

</head>

<body ng-controller="OrderCtrl">

<h1>Order Form</h1>

<form>

<table>

<tr>

<th>Product Name</th>

<th>Price (INR)</th>

<th>Quantity</th>

<th>Total (INR)</th>

</tr>

<tr ng-repeat="product in products">

<td>{{ product.name }}</td>

<td><input type="number" ng-model="product.price" ng-


change="calculateTotal()"></td>

<td><input type="number" ng-model="product.quantity" ng-


change="calculateTotal()"></td>

<td>{{ product.total }}</td>

</tr>

<tr>
<td colspan="3">Subtotal (INR)</td>

<td>{{ subtotal }}</td>

</tr>

<tr>

<td colspan="3">GST (18%)</td>

<td>{{ gst }}</td>

</tr>

<tr>

<td colspan="3"><strong>Total (INR)</strong></td>

<td><strong>{{ total }}</strong></td>

</tr>

</table>

</form>

<script>

var app = angular.module('orderForm', []);

app.controller('OrderCtrl', function($scope) {

$scope.products = [

{ name: 'Product 1', price: 0, quantity: 0 },

{ name: 'Product 2', price: 0, quantity: 0 },

{ name: 'Product 3', price: 0, quantity: 0 },

{ name: 'Product 4', price: 0, quantity: 0 },

{ name: 'Product 5', price: 0, quantity: 0 }

];

$scope.calculateTotal = function() {

$scope.subtotal = 0;

angular.forEach($scope.products, function(product) {

product.total = product.price * product.quantity;


$scope.subtotal += product.total;

});

$scope.gst = $scope.subtotal * 0.18;

$scope.total = $scope.subtotal + $scope.gst;

};

$scope.calculateTotal();

});

app.directive('numberInput', function() {

return {

require: 'ngModel',

link: function(scope, element, attrs, ngModel) {

ngModel.$parsers.push(function(value) {

return parseInt(value, 10);

});

ngModel.$formatters.push(function(value) {

return value.toString();

});

};

});

</script>

</body>

</html>

Output:
Practical 4
Aim: design a webpage which takes one number as an input and generates its
factorial number(use module, controller)

Sol:
<!DOCTYPE html>

<html ng-app="factorialApp">

<head>

<title>Factorial Generator</title>

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.8.2/angular.min.js"></script>

</head>

<body ng-controller="FactorialCtrl">

<h1>Factorial Generator</h1>

<form>

<label for="number">Enter a number:</label>

<input type="number" id="number" ng-model="number" ng-change="calculateFactorial()"


required>

<p ng-show="isInvalid">Please enter a valid number.</p>

<p ng-show="!isInvalid && isCalculating">Calculating factorial...</p>

<p ng-show="!isInvalid && !isCalculating">The factorial of {{ number }} is {{ factorial


}}.</p>

</form>

<script>

var app = angular.module('factorialApp', []);

app.controller('FactorialCtrl', function($scope) {

$scope.calculateFactorial = function() {

if ($scope.number >= 0) {

$scope.isInvalid = false;

$scope.isCalculating = true;

var factorial = 1;
for (var i = 2; i <= $scope.number; i++) {

factorial *= i;

$scope.factorial = factorial;

$scope.isCalculating = false;

} else {

$scope.isInvalid = true;

};

});

</script>

</body>

</html>

Output:-
Practical 5
Aim: Design a webpage which takes input product name, product quantity and
price Generate table of entered values. When user clicks on tables column title,
it should sort that column values. {use filter, array}

Sol:
<!DOCTYPE html>

<html ng-app="productApp">

<head>

<title>Product Table</title>

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.8.2/angular.min.js"></script>

</head>

<body ng-controller="ProductCtrl">

<h1>Product Table</h1>

<form ng-submit="addProduct()">

<label for="name">Product Name:</label>

<input type="text" id="name" ng-model="newProduct.name" required>

<label for="quantity">Product Quantity:</label>

<input type="number" id="quantity" ng-model="newProduct.quantity" required>

<label for="price">Product Price:</label>

<input type="number" id="price" ng-model="newProduct.price" required>

<button type="submit">Add Product</button>

</form>

<table border="1">

<thead>
<tr>

<th ng-click="sortTable('name')">Product Name</th>

<th ng-click="sortTable('quantity')">Product Quantity</th>

<th ng-click="sortTable('price')">Product Price</th>

</tr>

</thead>

<tbody>

<tr ng-repeat="product in products | orderBy:sortColumn">

<td>{{ product.name }}</td>

<td>{{ product.quantity }}</td>

<td>{{ product.price }}</td>

</tr>

</tbody>

</table>

<script>

var app = angular.module('productApp', []);

app.controller('ProductCtrl', function($scope) {

$scope.products = [];

$scope.newProduct = {};

$scope.addProduct = function() {

$scope.products.push({

name: $scope.newProduct.name,

quantity: $scope.newProduct.quantity,

price: $scope.newProduct.price

});

$scope.newProduct = {};
};

$scope.sortTable = function(column) {

if ($scope.sortColumn === column) {

$scope.sortColumn = '-' + column;

} else {

$scope.sortColumn = column;

};

});

</script>

</body>

</html>

Output:

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy