Tuesday, May 3, 2011

UPTU/GBTU/MMTU practical files software engg / webtech practical file

                  software engg / webtech practical file
                                        Program- 1
Write html code to display your resume in a web browser using all formatting tags.
<html>
<body>
<h2>RESUME</h2>
<HR/>
<H3>John</H3>
<br/>
Ghaziabad 201001
<br/>
Mob-…………………..
<br/>
EMAIL- abcd@gmail.com
<hr/>
<h4><u>OBJECTIVE:</u></h4>
<p> I wish to work in IT Industries in the field of Java Technology .</p>
<h3><u>IT EXPOSURE</u></h3>
<h4>EDUCATION</h4>
VIET G.Noida <br/>
B Tech(Comp. Sci.)<br/>
Percentage Scored:__%<br/>
<br/><br/>
__________college <br/>
12th<br/>
Percentage Scored: __%<br/>
<br/><br/>
__________college <br/>
10th<br/>
Percentage Scored:__ %<br/>
<br/><br/>
<h4><u>TECHNICAL EXPERIENCE</u></h4>
<ul>
<li><font face="Arial" size="2">Languages: C, HTML </font></li>
</ul>
<hr/>
</body>
</html>


                                               
                                                              Program-2
Write html code to display an image and make that image clickable.
<html>
<body style= "background-color:cyan">
<h1 style ="font-family:constantia;color:red;font-size:25px">Click on the Image </h1>
<title>My HTML page</title>
<a href="http://gmail.com" target="_blank" ><img src = "pandey.jpg" alt="Amit Pandey" width="500"
height="400" >
<a><br>
Amit Kumar Pandey<br>
</FORM>
</body>
</html>


                                                         Pogram-3
Create an external style sheet and link it to html tags.
<html>
<head>
<title>external css</title>
<link rel="stylesheet" type="text/css" href="3.css">
<h1>This is external style sheet</h1>
</head>
<body>
<h2> Introduction</h2>
<p>Cascading Style Sheets (CSS) is a style sheet language used to describe the presentation
 semantics (the look and formatting) of a document written in a markup language.
<br>Its most common application is to style web pages written in HTML and XHTML,
but the language can also be applied to any kind of XML document, including plain XML,
 SVG and XUL.</p>
</body>
</html>


                             Program-4
Write a JavaScript code to find the factorial of a given no. using recursion.
<html>
<head><title>factorial</title>
<script language="javascript">
var n=prompt("enter the number");
function Factorial(n)
{
if (n > 0)
  return n*Factorial(n - 1)
  else return 1;
}
  document.write("the factorial of = "+n+ "is"  + Factorial(n) + "<BR>");
</script>
</head>
<body onload="Factorial(n);">
</body>
</html>



                  Program-5
Write a JavaScript code to blink a text .

<html><head><title>BLINK</title>
<script type="text/javascript">
var str = "Hello world!";
document.write(str.blink());
</script>
</head>
</html>

                                     Program-6
Write a JavaScript code that starts changing background color of a web page when the user click on “start” button and stops as the user click on “stop” button.

Html Code:
<style type="text/css">
.tab{border: 1px inset black; background-color: black;}
</style>
<form name=colchanger>
<table style="width:100%;" id='tbprev'>
<tr><td>
<table class=tab cellpadding=0 cellspacing=0>
<script type="text/javascript">
for(i=0;i<=256;i+=18)
{
if(i==252) i=255;
document.write("<tr>");
for(j=0;j<=256;j=j+51)
{
for(k=0;k<=256;k=k+51)
{ document.write("<td onclick='clicked("+i+","+j+","+k+")' \
style=\"border: 1px inset black; width:10px; \
height: 3px; font-size: 6px; background-color: rgb("+i+","+j+","+k+");\""+"> </td>");
}
}
document.write("</tr>");
}
</script>
</table>
</td></tr>
</table>
</form>
Java Script Code:-
<script type="text/javascript">
function clicked(gg,rr,bb)
{
1. var hex='#'+deciToHex(gg)+deciToHex(rr)+deciToHex(bb);
document.body.style.backgroundColor=hex;
}. function getHexNum(num)
{
ar1=new Array('0','1','2','3','4','5','6','7','8','9','10','11','12','13','14','15');
ar2=new Array('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F');
if(num>15)
return num;
else
{ red=ar2[num];
return red;
}
}
function deciToHex(arg)
{ res2=999;
args=arg;
while(args>15)
{
arg1=parseInt(args/16);
arg2=args%16;
arg2=getHexNum(arg2);
args=arg1;
if(res2==999)
res2=arg2.toString();
else
res2=arg2.toString()+res2.toString();
}
if(args<16 && res2 != 999)
{
def=getHexNum(args);
res2=def+res2.toString();
}
else if(res2==999)
{ if(args<16)
res2=getHexNum(args);
else
res2=1;
} if(res2.length==1)
res2="0"+res2;
return res2; }
</script>



                                             Program-7
Write a Java script code to open a new window and change the background and add same text.
<html>
<head>
<script type="text/javascript">
function open_win()
{
window.open("http://www.w3schools.com","_blank","toolbar=yes, location=yes, directories=no, status=no, menubar=yes, scrollbars=yes, resizable=no, copyhistory=yes, width=400, height=400");
}
</script>
</head>

<body>
<form>
<input type="button" value="Open Window" onclick="open_win()">
</form>
</body>

</html>

                                   Program-8
Write a Java Script code to display digital clock.
<html>
<head>
<STYLE>
.details
{
font-family : MS Sans Serif, arial;
font-size : 14;
font-weight : bold;
color : #000000;
background-color : #CCCCCC;
}
</STYLE>
</head>
<body onLoad="curTime()">
<script language="JavaScript" type="text/javascript">
function curTime()
{
var now=new Date()
var hrs=now.getHours()
var min=now.getMinutes()
var sec=now.getSeconds()
var don="AM"
if (hrs>=12){ don="PM" }
if (hrs>12) { hrs-=12 }
if (hrs==0) { hrs=12 }
if (hrs<10) { hrs="0"+hrs }
if (min<10) { min="0"+min }
if (sec<10) { sec="0"+sec }
clock.innerHTML=hrs+":"+min+":"+sec+" "+don
setTimeout("curTime()",1000)
}
</script>
<SPAN CLASS=details ID=clock STYLE="position:relative;"></SPAN>
</body>
</html>


                                      Program -9
Write a JavaScript code to check that password field should contains more than 6 characters.
<script type="text/javascript">
function checkForm(form)
{
if(form.username.value == "") {
alert("Error: Username cannot be blank!");
form.username.focus();
return false;
}
re = /^\w+$/;
if(!re.test(form.username.value)) {
alert("Error: Username must contain only letters, numbers and underscores!");
form.username.focus();
return false;
}
if(form.pwd1.value != "" && form.pwd1.value == form.pwd2.value) {
if(form.pwd1.value.length < 6) {
alert("Error: Password must contain at least six characters!");
form.pwd1.focus();
return false;
}
if(form.pwd1.value == form.username.value) {
alert("Error: Password must be different from Username!");
form.pwd1.focus();
return false;
}


                                 
                                       Program-10
Write a JavaScript code to check that email id should contains a single @ symbol.
<SCRIPT language=JavaScript >
<!--
function Validator(theForm)
{ if ( theForm.email_id.value == "")
{
alert( "Please enter a Email ID for the field." );
theForm.email_id.focus();
return ( false );
}
if ( theForm.email_id.value.length < 5)
{
alert( "Please enter a valid Email ID in the field.");
theForm.email_id.focus();
return ( false );
}
var check_at = "@";
var check_dot = "." var checkStr = theForm.email_id.value;
var allValid = false;.
for (i = 0; i < checkStr.length; i++)
{
ch_at = checkStr.charAt(i);
if(ch_at == '~' || ch_at == '`' || ch_at == '!' || ch_at == '#')
{
allValid = false;
break;
}
if (ch_at == check_at)
{
for (j = i+2; j < checkStr.length; j++).
{
ch_dot = checkStr.charAt(j);
if (ch_dot == check_dot && checkStr.charAt(j+1) != "") {
allValid = true;
break;
}
}
}
}
if (!allValid) {
alert("Please enter a valid Email ID for field.");
theForm.email_id.focus();
return (false);
}
else.
{
return(true);
}
}-->
</SCRIPT>


                                          Program-11
Write a java script code to check user should left the name and age field blank
<html>
<head>
<title>form<title>
<script language="javascript">
function validateForm()
{
var x=document.forms["myForm"]["username"].value
var y=document.forms["myForm"]["age"].value
if (x==null || x=="")
  {
  alert(" username must be filled out");
  return false;
  }
if (y==null || y=="")
  {
  alert(" age must be filled out");
  return false;
  }
}
</script>
</head>
<form name="myForm" onsubmit="return validateForm()" >
 <input type="text" name="username">Username<br>
<input type="text" name="age">Age<br>
<input type="submit" value="Submit">
</form>
</html>

No comments:

Post a Comment