Anurag Devnath Bca 1web TCH
Anurag Devnath Bca 1web TCH
PRACTICAL ASSIGNMENT
ON
SESSION: 2021-2022
SUBMITTED TO
GD RUNGTA COLLEGE OF SCIENCE AND TECHNOLOGY, BHILAI (C.G)
CERTIFICATE BY THE EXAMINER
This is to certify that the project work entitled “WEB TECHNOLOGY AND
E-COMMERCE” submitted by Prakritee John of BCA 1st YEAR has been
examined by the undersigned as a part of the examination and is here by
recommended for the degree of Bachelor of Computer Application of
Hemchand Yadav vishwavidyalaya, Durg.
Internal Examiner
Date:
ACKNOWLEDGEMENT
The real spirit of achieving a goal is through the way of excellence and
austerious discipline. I want to thank GDRCST, Bhilai for providing me the
necessary software, tools and other resources to deliver my Practical assignment.
Prakritee John
INDEX
HTML
1 Write an HTML Program to create the following table:
C
C++
FORTRAN
COBOL
1. Java
2. Visual Basic
3. BASIC
4. COBOL
10 Write an HTML Program to create the Web Page with alt text and
width and height of 300 pixel
S.NO. PRACTICALS Pg.no.
JAVASCRIPT
1 Write an JAVASCRIPT Program to create a script using for loop to prime no
between 1 to 50
DHTML
1 Create a Web Page which explain the use of relative positioning
PHP
1 Create a script using for loop to add all integers between 0 and 30 and display
the total
2 Create a script using for loop to find largest value in array.
<!---Write an JAVASCRIPT Program to create a script using for loop to prime no between 1 to 50 -
--->
<html>
<head>
<title>Prime Number</title>
</head>
<body>
<script>
var num,i;
document.write("Prime Number betweeen 1 to 50 using loop: <br>");
for(i=1;i<=50;i++)
{
var flag=true;
for(num=2;num<i;num++){
if(i%num==0){
flag=false;
break;
}
}
if(flag){
document.write(i+", ");
}
}
</script>
</body>
</html>
Output:-
Program no 2:- Write an JAVASCRIPT Program to calculate factorial using function
<html>
<head>
<title>Program no 23</title>
</head>
<body>
Enter No:<input id="num" name="num"/><br/>
<button onclick="factorial()">Factorial</button><p id = "res"></p>
<script type="text/javascript">
function factorial(){
var num,i,f;
num=document.getElementById("num").value;
f=1;
for(i=1;i<=num;i++){
f=f*i;
}
i=i-1;
document.getElementById("res").innerHTML="The factorial of the number "+i+ "is:" +f;
}
</script>
</body>
</html>
Output:-
Program no 3:- Write an JAVASCRIPT Program to validate data
<html>
<head>
<title>Program no 24</title>
</head>
<body>
<script>
function validate(){
var num=document.myform.num.value;
if (isNaN(num)){
document.getElementById("numloc").innerHTML="Enter only Numeric value ";
return false;
}else{
return true;
}
}
</script>
<form name="myform" onsubmit="return validate()" >
Enter a Number: <input type="text" name="num"><span id="numloc"></span><br/>
<input type="submit" value="submit">
</form>
</body>
</html>
Output:-
Program no 4:- Write an JAVASCRIPT Program to print Date
<html>
<head>
<title>Program no 25</title>
</head>
<body>
Current Date and Time: <span id="txt"></span>
<script>
var today=new Date();
document.getElementById('txt').innerHTML=today;
</script>
</body>
</html>
Output:-
Program no 5:- Write an JAVASCRIPT Program to calculate sum and multiplication of two
numbers
<html>
<head>
<title>Program no 26</title>
</head>
<body bgcolor="Grey">
<form name="C">
<p> Enter First Number:    <input type="text" name="n1" ><br>
<p> Enter Second Number:<input type="text" name="n2">
<br><br>
<input type="button" value=" Addition " onclick="add()">
<input type="button" value=" Multiply " onclick="mul()">
<input type="button" value="Reset">
</form>
<script language="JavaScript">
function add(){
var num1=parseFloat(C.n1.value);
var num2=parseFloat(C.n2.value);
var sum=num1+num2;
alert("Addition is ="+sum);
}
function mul(){
var num1=parseFloat(C.n1.value);
var num2=parseFloat(C.n2.value);
var mul=num1*num2;
alert("Multiplication is ="+mul);
}
</script>
</body>
</html>
Output
Program no 6:- Write an JAVASCRIPT Program to show alert, confirm and prompt box
<html>
<head><title>Program no 27</title></head>
<body bgcolor="grey">
<h3> Displaying Alert, Confirm and Prompt Box together</h3>
<script type="text/javascript">
function alert_msg(){
alert("Hello Alert Box");
}
function confirm_msg(){
var v= confirm("Confirm...");
if(v==true){
alert("ok");
}
else{
alert("cancel");
}
}
function prompt_msg(){
var v= prompt("Prompt Box");
alert("I am "+v);
}
</script>
<input type="button" value="Alert" onclick="alert_msg()"/>
<input type="button" value="Confirm" onclick="confirm_msg()"/>
<input type="button" value="Prompt" onclick="prompt_msg()"/>
</body>
</html>
Output:-
rogram no 7:- Write an JAVASCRIPT Program to validate form
<html>
<head><title>Program no 29</title></head>
<script>
function validateform(){
var name=document.myform.name.value;
var password=document.myform.password.value;
if (name==null || name==""){
alert("Name can't be blank");
return false;
}else if(password.length<6){
alert("Password must be at least 6 characters long.");
return false;
}
}
</script>
<body bgcolor="grey">
<h3> Form Validation</h3>
<form name="myform" method="post" action="abc.jsp" onsubmit="return validateform()" >
UserName:<input type="text" name="name"><br/> <br>
Password: <input type="password" name="password"><br/>
<input type="submit" value="Submit">
</form>
</body>
</html>
Output:-
DHTML
Program no 1:- Create a Web Page which explain the use of relative positioning
<html>
<head>
<style>
h4.pos_left {
position: relative;
left: 0px;
}
h1.pos_right {
position: relative;
left: 30px;
}
</style>
</head>
<body>
<h1 class="pos_right">Heading A</h1>
<h4>This is a paragraph</h4>
Output:-
Program no 2:- Design a Web Page to display a digital clock
<html>
<head><title>Program no 35</title></head>
Output:-
PHP
Program no 1:- Create a script using for loop to add all integers between 0 and 30 and
display the total
<!---Create a script using for loop to add all integers between 0 and 30 and display the total-->
<html>
<head>
<title>Program no 36</title>
</head>
<body>
<?php
$sum=0;
for($n=0;$n<=30;$n++){
$sum=$sum+$n;
}
echo "Sum of integers between 0 and 30 is =$sum" ;
?>
</body>
</html>
Output:-
Program no 2:- Create a script using for loop to find largest value in array.
<!---Create a script using for loop to add all integers between 0 and 30 and display the total-->
<html>
<head>
<title>Program no 38</title>
</head>
<body>
<?php
echo "Array:<br>";
$arr=array("55","45","15","25","35");
foreach( $arr as $a )
{
echo "$a<br />";
}
sort($arr); //sorting of array
echo "Largest value in Array: $arr[4]";
?>
</body>
</html>
Output:-
Program no 3:- Write a function to calculate the factorial of a number
Prog 39 IP.html
<html>
<body>
Prog 39.php
<html>
<head>
<title>Program no 39</title>
</head>
<body>
<?php
function factorial(){
$num=$_GET["num"]; //receiving name field value in $str variable
$f=1;
for($i=1;$i<=$num;$i++){
$f=$f*$i;
}
$i=$i-1;
echo "The factorial of the number $i is: $f";
}
factorial(); //calling function
?>
</body>
</html>
Output:-
Program no 4:- Check a string is Palindrome or not
Prog 40 IP.html
<html>
<body>
Prog 40.php
<html>
<head>
<title>Program no 40</title>
</head>
<body>
<?php
$str=$_GET["name"]; //receiving name field value in $str variable
$str1=strrev($str);
if($str==$str1){
echo "$str is Palindrome";}
else
echo"$str is not a Palindrome";
?>
</body>
</html>
Output:-