Basic HTML, Image: My First Image Is HTML Picture
Basic HTML, Image: My First Image Is HTML Picture
Basic HTML, Image: My First Image Is HTML Picture
Class –SE IT B
Batch – 2
Roll No. – 36
Aim - Write a code to implement Basic HTML, Formatting and Fonts, Commenting Code, Anchors, Backgrounds,
images, Hyperlinks.
<html>
<head>
<title>Basic HTML</title>
<h1>Header 1</h1>
<h2>Header 2</h2>
<h3>Header 3</h3>
<h4>Header 4</h4>
<h5>Header 5</h5>
<h6>Header 6</h6>
<div>difference between p tag and div tag</div>
<p>difference between p tag and div tag</p><br>
my first image<img src="html.jpg" alt="Pulpit rock" width="304" height="228" /> is html picture
<pre>
OUTPUT
Formatting and Fonts
<html>
<body>
<p><font size="2" color="blue">This is some text! using font tag,size attribute,color attribute</font></p>
<p><font face="verdana" color="green">This is some text!using font tag,face attribute,color attribute</font></p>
<b>This text is bold</b><br>
<strong>This text is strong</strong><br>
<big>This text is big</big><br>
<small>Small text</small><br>
<i>This text is italic</i><br>
<em>This text is emphasized</em><br>
<code>This is computer output</code><br>
This is<sub> subscript</sub> and <sup>superscript</sup><br>
My favorite color is <del>blue</del> <ins>red</ins>!<br>
<p>Notice that browsers will strikethrough deleted text and underline inserted text.</p>
<dfn>Definition term</dfn><br>
<samp>Sample computer code text</samp><br>
<kbd>Keyboard text</kbd><br>
<var>Variable</var><br>
<cite>Citation</cite><br>
The <abbr title="World Health Organization">WHO</abbr> was founded in 1948<br>
Can I get this <acronym title="as soon as possible">ASAP</acronym>?<br>
<tt>Teletype text</tt><br>
<address>
my address<br />
is in<br />
so n so place<br />
at so n so area
</address><br>
<bdo dir="rtl">Here is some Hebrew text that should be written from right-to-left!</bdo><!bidirectional override!
><br>
<blockquote>
Here is a long quotation here is a long quotation here is a long quotation here is a long quotation here is a long
quotation here is a long quotation here is a long quotation here is a long quotation here is a long quotation.
</blockquote><br>
<q>
Here is a short quotation here is a short quotation
</q><br>
</body>
</html>
OUTPUT
Commenting Code
<html>
<body>
</body>
</html>
OUTPUT
Anchors, Hyperlink
<html>
<body>
<p>
<h2>Chapter 1</h2>
<p>This chapter explains ba bla bla</p>
<h2>Chapter 2</h2>
<p>This chapter explains ba bla bla</p>
<h2>Chapter 3</h2>
<p>This chapter explains ba bla bla</p>
<h2><a >Chapter 4</a></h2>
<p>This chapter explains ba bla bla</p>
<h2>Chapter 5</h2>
<p>This chapter explains ba bla bla</p>
<h2>Chapter 6</h2>
<p>This chapter explains ba bla bla</p>
<h2>Chapter 7</h2>
<p>This chapter explains ba bla bla</p>
<h2>Chapter 8</h2>
<p>This chapter explains ba bla bla</p>
<h2>Chapter 9</h2>
<p>This chapter explains ba bla bla</p>
<h2>Chapter 10</h2>
<p>This chapter explains ba bla bla</p>
<h2>Chapter 11</h2>
<p>This chapter explains ba bla bla</p><br>
</body>
</html>
OUTPUT
Background
<html>
<head>
<title>Text</title>
<body background="Background.jpg">
</body>
</head>
OUTPUT
Name – Shelton Nazareth
Class –SE IT B
Batch – 2
Roll No. – 36
Aim - Write a HTML code to implement class timetable and three different type of list.
Timetable
<html>
<head>
<title>SE IT B timetable</title>
</head>
<body>
<font face="Century Gothic" size=4">
<table border = "3" bordercolor="black" cellpadding="5">
<caption><b><u>SE IT B timetable</u></b></caption>
<tr>
<td align="center"><b><u>D & T</b></u></td>
<td align="center" colspan = "3"><u><b>Monday</b></u></td>
<td align="center" colspan = "3"><b><u>Tuesday</u></b></td>
<td align="center" ><b><u>Wednesday</u></td>
<td align="center" colspan = "3"><b><u>Thursday</u></td>
<td align="center" colspan = "3"><b><u>Friday</u></td>
</tr>
<tr>
<td align="center">8 - 9</td>
<td align="center" rowspan = "2"><font color="red">IP Prac's</font></td>
<td align="center" rowspan = "2"><font color="blue">CM Prac's</font></td>
<td align="center" rowspan = "2"><font color="green">NTDD Prac's</font></td>
<td align="center" rowspan = "2"><font color="red">IP Prac's</font></td>
<td align="center" rowspan = "2"><font color="blue">NTDD Prac's</font></td>
<td align="center" rowspan = "2"><font color="green">PCOM Prac's</font></td>
<td align="center" >CM Lec</td>
<td align="center" rowspan = "2"><font color="red">CM Prac's</font></td>
<td align="center" rowspan = "2"><font color="blue">PCOM Prac's</font></td>
<td align="center" rowspan = "2"><font color="green">IP Prac's</font></td>
<td align="center" colspan="3" > PCOM Lec</td>
</tr>
<tr>
<td align="center">9 - 10</td>
<td align="center" >FAMT Lec</td>
<td align="center" colspan="3">IP Lec</td>
<tr>
<td align="center">10 - 10:15</td>
<td align="center" colspan="13"><b><u>Tea Break</b></u><td>
</tr>
<tr>
<td align="center" >10:15 - 11:15</td>
<td align="center" colspan="3">FAMT Lec</td>
<td align="center" colspan="3">CM Lec</td>
<td align="center">PCOM Lec</td>
<td align="center" colspan="3">NTDD Lec</td>
<td align="center" colspan="3">MPMC Lec</td>
</tr>
<td align="center" >11:15 - 12:15</td>
<td align="center" colspan="3">PCOM Lec</td>
<td align="center" colspan="3">FAMT Lec</td>
<td align="center">NTDD Lec</td>
<td align="center" colspan="3">CM Lec</td>
<td align="center" colspan="3">NTDD Lec</td>
</tr>
<tr>
<td align="center">12:15 - 1</td>
<td align="center" colspan="13"><b><u>Lunch Break</u></b><td>
</tr>
<tr>
<td align="center">1 - 2</td>
<td align="center" colspan="3">MPMC Lec</td>
<td align="center" rowspan="2"><font color="red">PCOM Prac's</font></td>
<td align="center" rowspan="2"><font color="blue">IP Prac's</font></td>
<td align="center" rowspan="2"><font color="green">CM Prac's</font></td>
<td align="center">MPMC Lec</td>
<td align="center" colspan="3">PCOM Lec</td>
<td align="center" rowspan="2"><font color="red">NTDD Prac's</font></td>
<td align="center" rowspan="2"><font color="blue">IP Prac's</font></td>
<td align="center" rowspan="2"><font color="green">PCOM Prac's</font></td>
</tr>
<tr>
<td align="center">2 - 3</td>
<td align="center" colspan="3">NTDD Lec</td>
<td align="center">IP Lec</td>
<td align="center" colspan="3">FAMT Lec</td>
</tr>
<tr>
<td align="center">3 - 4</td>
<td align="center" rowspan="2"><font color="red">MPMC Prac's</font></td>
<td align="center"><font color="blue">FAMT tuts</font></td>
<td align="center" rowspan="2"><font color="green">IP Prac's</font></td>
<td align="center" colspan="3">MPMC Lec</td>
<td align="center" rowspan="2">free slot</td>
<td align="center" rowspan="2">free slot</td>
<td align="center" rowspan="2"><font color="blue">MPMC Prac's</font></td>
<td align="center" ><font color="green">FAMT tuts</font></td>
<td align="center" colspan="3">CM Lec</td>
</tr>
<tr>
<td align="center">4 - 5</td>
<td align="center" >free slot</td>
<td align="center" colspan="3">free slot</td>
<td align="center">free slot</td>
<td align="center"><font color="red">FAMT tuts</font></td>
<td align="center">free slot</td>
<td align="center">free slot</td>
</tr>
</table>
<p><font color="red"><b>Red=batch 1</b></font><br/><font color="blue"><b>Blue=batch 2</b></font><br/><font
color="green"><b>Green=batch 3</b></font><br/><b>Black=for full class</b></p>
OUTPUT
LIST
Unordered list
<html>
<head>
<title>lists</title>
</head>
<body>
<H2>Types of unordered lists</h2>
<h4>Disc bullets list:</h4>
<ul type="disc">
<li>Apples</li>
<li>Bananas</li>
<li>Lemons</li>
<li>Oranges</li>
</ul>
<h4>Circle bullets list:</h4>
<ul type="circle">
<li>Apples</li>
<li>Bananas</li>
<li>Lemons</li>
<li>Oranges</li>
</ul>
<h4>Square bullets list:</h4>
<ul type="square">
<li>Apples</li>
<li>Bananas</li>
<li>Lemons</li>
<li>Oranges</li>
</ul>
</body>
</html>
Output
Ordered list
Output
Nested list
<h4>A nested List:</h4>
<ul>
<li>Coffee</li>
<li>Tea
<ul>
<li>Black tea</li>
<li>Green tea</li>
</ul>
</li>
<li>Milk</li>
</ul>
Output
Definition list
<h4>DEFINITION LIST</H4>
<dl>
<dt>Coffee</dt>
<dd>- black hot drink</dd>
<dt>Milk</dt>
<dd>- white cold drink</dd>
</dl>
Output
Aim - Write a HTML code to implement forms and frames.(include text, password, radio, checkbox,
dropdown(select),button in form)
MAIN.HTML
<html>
<head>
<title>site</title>
</head>
<frameset rows="35%,65%">
<frame src="3.html" name="top">
<frameset cols="20%,80%">
<frame src="4.html" name="left">
<frame src="`.html" name="right">
</frameset>
</frameset>
</html>
<html>
<head>
<title>
Departments
</title>
<dl>
<dt>-IT Dept.</dt>
<dd>-->Na</dd>
<dt>-Computer Dept.</dt>
<dd>-->NA</dd>
<dt>-EXTC Dept.</dt>
<dd>-->NA</dd>
</dl>
</body>
</html>
<html>
<head>
<title>resume</title>
</head>
<body>
<font face="Century Gothic" size="2">
<center><u><big><b>RESUME</b></u></big></center>
<form>
<table width="900" border="4" cellspacing="10" cellpadding="10">
<tr><td><u>Name: </u></td>
<td> <input type="text"></td><br>
</tr>
<tr>
<td><u>Address:<u></td>
<td><textarea rows="3"
columns="1"
wrap=virtual></textarea></td>
</tr>
<tr>
<td><u>Password:</u></td>
<td><input type="password"></td>
</tr>
<tr>
<td><u>Gender</u></td>
<td><input type="radio" Name=a>Male</radio></td>
<td><input type="radio" Name=a>Female</radio></td>
</tr>
<tr>
<td><u>Qualifications:</u></td>
<td><input type="checkbox">SSC </td>
<td><input type="checkbox">HSC</td>
<td><input type="checkbox">DIPLOMA</td>
<td><input type="checkbox">DEGREE</td>
<td><input type="checkbox">MBA</td>
</tr>
<tr>
<td><input type="submit"></td>
<td rowspan="2"><input type="reset"></td>
</tr>
</table>
</form>
</body>
</html>
<html>
<head>
<title>
SFIT File Format
</title>
<body>
<center><font face="Century Gothic" size="2">
<font face="Algerian" size="6"><u>ST FRANCIS INSTITUTE OF TECHNOLOGY</u></font>
<font face="Century Gothic" size="3">
<br><br>ENGINEERING COLLEGE</br>
Mount Poisur, S.V.P Road,Borivali(W),Mumbai-103</br></font>
<br><a href="http://sfitb.webs.com" target="__blank"><img src="sfit.bmp"></a>
<br>
</center>
</body>
</head>
</html>
<html>
<title>hyperlink</title>
<head><body>
<big><a href="3.html" target="right">Home</a><br><br>
<a href="1.html" target="right">Departments</a><br><br>
<a href="2.html" target="right">Resume</a><br><br>
<a href="mailto:sfit.it@gmail.com? Subject=Site Check & body=******">Contact us</a>
</body>
</head>
</html>
3 types of selectors
ID selector
<html>
<head>
<style type="text/css">
#para1
{
text-align:center;
color:red;
}
</style>
</head>
<body>
<p id="para1">Hello World!</p>
<p>This paragraph is not affected by the style.</p>
</body>
</html>
OUTPUT
Class Selector
<html>
<head>
<style type="text/css">
.center
{
text-align:center;
}
</style>
</head>
<body>
<h1 class="center">Center-aligned heading</h1>
<h1>Not Affected</h1>
<p class="center">Center-aligned paragraph.</p>
<p>Not Affected</p>
</body>
</html>
OUTPUT
Tag selector
<html>
<head>
<style type="text/css">
b{font-family:arial;font-size:34px;color:blue;text-decoration:underline;}
</style>
</head>
<body>
<b>This is tag selector</b>
</body>
</html>
OUTPUT
3 css level
Inline style
<html>
<head>
</head>
<body>
<h2 style="color:green;text-decoration:underline;">Introduction</h2>
<i style="font-size:16px;color:blue;">History, Web System, Architecture, URL, DNS</i>
<h2 style="color:green;text-decoration:underline;">HTML</h2>
<i style="font-size:16px;color:blue;">Basic tags</i>
<h2 style="color:green;text-decoration:underline;">CSS</h2>
<i style="font-size:16px;color:blue;">need, introduction</i>
</body>
</html>
OUTPUT
Internal Style Sheet
<html>
<head>
<style type="text/css">
hr {color:sienna;}
p {margin-left:20px;color:blue;}
body {background-image:url("background.jpg");}
</style>
</head>
<body>
<p>Internal Style Sheet</p>
<hr></hr>
<h2 >Not Affected as no tag defined</h2>
</body>
</html>
OUTPUT
External Style Sheet
(.css)File
h2{color:red;text-decoration:underline;}
i{font-style:oblique;font-size:relative:75%;color:blue;}
(.html)File
<html>
<head>
</head>
<body>
<h2 style="color:blue;text-decoration:underline;">Introduction</h2>
<i style="font-size:16px;color:red;">History, Web System, Architecture, URL, DNS</i>
<h2 style="color:blue;text-decoration:underline;">HTML</h2>
<i style="font-size:16px;color:red;">Basic tags</i>
<h2 style="color:blue;text-decoration:underline;">CSS</h2>
<i style="font-size:16px;color:red;">need, introduction</i>
</body>
</html>
OUTPUT
Properties(text,font,background,image,table,link,list,padding,margin,positioning,Z-Index)
Background
<html>
<head>
</head>
<body>
<p style="background-color:yellow;">This text has a background color applied.</p>
<p style="height:100px;background-image:url(1.jpg);">This text has a background image applied. </p>
<p style="height:100px;background-image:url(1.jpg);background-repeat:no-repeat;">This background image
does not repeat. </p>
<p style="height:100px;background-image:url(1.jpg);background-repeat:no-repeat;background-
position:100px;">This background image is positioned 100 pixels in from the left. </p>
<p style="height:100px;width:150px;overflow:scroll;background-image:url(1.jpg);background-
attachment:fixed;">This background image is fixed- it doesn't scroll with its outer container.
random text
random text</p>
</body>
</html>
OUTPUT
Font
<html>
<head>
</head>
<body>
<p style="font-family:georgia;">This text is rendered in georgia.</p>
<p style="font-size:20px;">This text is using a font size of 20 pixels.</p>
<p style="font-style:italic;">This text is in italics.</p>
<p style="font-weight:bold;">This text is bold.</p>
<p style="font-variant:small-caps;">This Text Is Using Caps.</p>
<p style="font:italic small-caps bold 20px georgia;">The styles for this text has been specified with the 'font'
shorthand property.</p>
</body>
</html>
OUTPUT
Link
<html>
<head>
<style type="text/css">
a:link {color:#FF0000;} /* unvisited link */
a:visited {color:#00FF00;} /* visited link */
a:hover {color:#FF0000;} /* mouse over link */
a:active {color:#0000FF;} /* selected link */
a:link {text-decoration:none;}
a:visited {text-decoration:none;}
a:hover {text-decoration:underline;}
a:active {text-decoration:underline;}
a:link {background-color:#B2FF99;}
a:visited {background-color:#FFFF85;}
a:hover {background-color:#FF704D;}
a:active {background-color:#FF704D;}
</style>
</head>
<body>
<p><b><a href="default.asp" target="_blank">This is the link,click/hover mouse over to see CSS link stying
effects</a></b></p>
<p><b>Note:</b>hover mouse over link to see color change</p>
<p><b>Note:</b>click on link and see color change after clicking</p>
</body>
</html>
OUTPUT
List
<html>
<head>
<style type="text/css">
ul
{
list-style-image:url('2.jpg');
}
ol.c {list-style-type:upper-roman;}
ol.d {list-style-type:lower-alpha;}
</style>
</head>
<body>
<p>Example of unordered lists with CSS styling:</p>
<ul class="a">
<li>Coffee</li>
<li>Tea</li>
<li>Coca Cola</li>
</ul>
<ul class="b">
<li>Coffee</li>
<li>Tea</li>
<li>Coca Cola</li>
</ul>
<ol class="c">
<li>Coffee</li>
<li>Tea</li>
<li>Coca Cola</li>
</ol>
<ol class="d">
<li>Coffee</li>
<li>Tea</li>
<li>Coca Cola</li>
</ol>
</body>
</html>
OUTPUT
Margin, Padding
<html>
<head>
<style type="text/css">
p
{
background-color:yellow;
}
p.padding
{
padding-top:25px;
padding-bottom:25px;
padding-right:50px;
padding-left:50px;
}
p.margin
{
margin-top:20px;
margin-bottom:100px;
margin-right:50px;
margin-left:50px;
}
</style>
</head>
<body>
<p>This is a paragraph with no specified padding.</p>
<p class="padding">This is a paragraph with specified paddings.</p>
<p>This is a paragraph with no specified margins.</p>
<p class="margin">This is a paragraph with specified margins.</p>
</body>
</html>
OUTPUT
Table
<html>
<head>
<style type="text/css">
table
{
border-collapse:collapse;
width:50%
}
table, td, th
{
border:1px solid red;
}
th
{
height:50px;
background-color:yellow;
color:black;
}
td
{
text-align:right;
vertical-align:bottom;
padding:15px;
}
</style>
</head>
<body>
<table>
<tr>
<th>Firstname</th>
<th>Lastname</th>
</tr>
<tr>
<td>Peter</td>
<td>Griffin</td>
</tr>
<tr>
<td>Lois</td>
<td>Griffin</td>
</tr>
</table>
</body>
</html>
OUTPUT
POSITIONING
<html>
<head>
<style type="text/css">
h1{position:absolute;
bottom:150 px;
right:100 px}
p{{position:absolute;
bottom:200 px;
right:100 px}
</style>
</head>
<body>
<h1>This is heading</h1>
<p>This is paragraph</p>
</body>
</html>
OUTPUT
TEXT
<html>
<head>
</head>
<body>
<p style="text-indent:50px;">This text is indented by 50 pixels. What this means is that the first line of the
paragraph will be indented by 50 pixels,<br>but the following lines will not be indented.</p>
<p style="text-shadow:4px 4px 8px blue;">If your browser supports the CSS text-shadow property, this text will
have a shadow.</p>
</body>
</html>
OUTPUT
Name – Shelton Nazareth
Class –SE IT B
Batch – 2
Roll No. – 36
DISPLAY STRING
<html>
<body>
<script type="text/javascript">
document.write("<h4>hello</h4><br>");
document.write("<b>bold</b><br>");
document.write("<i>italic</i><br>");
document.write("<u>underline</u><br>");
alert("msg properly displayed")
</script>
</body>
</html>
OUTPUT
POPUP BOXES(ALERT,CONFIRM,PROMPT)
<head>
<script type="text/javascript">
function show_confirm()
{var r=confirm("Press a button!");
if (r==true)
{ alert("You pressed OK!");}
else
{ alert("You pressed Cancel!");}
}
function show_alert()
{
alert("I am an alert box!");
}
function show_prompt()
{
var name=prompt("Please enter your name","Harry Potter");
if (name!=null && name!="")
{
document.write("Hello " + name + "! How are you today?");
}
}
</script>
<body>
<input type="button" onclick="show_alert()" value="Show alert box" />
<input type="button" onclick="show_confirm()" value="Show a confirm box" />
<input type="button" onclick="show_prompt()" value="Show prompt box" />
</body>
3 ways(head, body, external)
Head
<html><head>
<script type="text/javascript">
function displayDate()
{
document.getElementById("demo").innerHTML=Date();
}
</script>
</head>
<body>
<p id="demo"></p>
</body>
</html>
Body
<html>
<body>
<p id="demo"></p>
<script type="text/javascript">
document.getElementById("demo").innerHTML=Date();
</script>
</body>
</html>
External
external.js
document.write("<h3>The text was written by an external script</h3>");
external_java.html
<html>
<head>
</head>
<body>
<script type="text/javascript" src="external.js">
</script>
<p>
The actual script is in an external script file called "external.js".
</p>
</body>
</html>
OUTPUT
Operators(calculator program)
<html>
<head><title>Calculator</title>
<script language="javascript">
var inputstring=" "
function updatestring(value)
{
inputstring += value;
document.calculator.input.value=inputstring;
}
</script>
</head>
<body>
<center>
<h1>Calculator</h1>
<form name="calculator">
<table border=5 bordercolor=blue>
<tr><td>
</td></tr>
</table>
</form>
</body>
OUTPUT
Function(calculate area program)
<html>
<head>
<script type="text/javascript">
function area(r)
{
return Math.PI * Math.pow(r,2);
}
</script>
</head>
<body>
<script type="text/javascript">
var r=prompt('Please enter the radius of the circle: ');
</body>
</html>
OUTPUT
Conditional(To display date)
<body>
<script type="text/javascript">
var d=new Date();
var theDay=d.getDay();
document.write(d+"<br>");
document.write(theDay+"<br>");
switch (theDay)
{
case 0:
document.write("Sunday");
break;
case 1:
document.write("monday");
break;
case 2:
document.write("tuesday");
break;
case 3:
document.write("wednesday");
break;
case 4:
document.write("thursday");
break;
case 5:
document.write("Friday");
break;
case 6:
document.write("Saturday");
break;
default:
document.write("weekend!");
}
</script>
</body>
Loop(heading program)
<body>
<script type="text/javascript">
for(i=1;i<=6;i++)
{document.write("<h"+i+">Heading"+i+"</h"+i+">");}
</script>
OUTPUT
Built-in objects(String, Array, Date, Math, History)
STRING
<html>
<body>
<script type="text/javascript">
</body>
</html>
OUTPUT
Array
<html>
<body>
<script type="text/javascript">
var i;
var myhobbies = new Array();
myhobbies[0] = "Sports";
myhobbies[1] = "Reading";
myhobbies[2] = "Dancing";
for (i=0;i<myhobbies.length;i++)
{
document.write(myhobbies[i] + "<br />");
}
</script>
</body>
</html>
OUTPUT
Date
<html>
<body>
<script type="text/javascript">
d.setFullYear(1992,10,3);
document.write(d + "<br />");
function startTime()
{
var today=new Date();
var h=today.getHours();
var m=today.getMinutes();
var s=today.getSeconds();
// add a zero in front of numbers<10
m=checkTime(m);
s=checkTime(s);
document.getElementById('txt').innerHTML=h+":"+m+":"+s;
t=setTimeout('startTime()',500);
}
function checkTime(i)
{
if (i<10)
{
i="0" + i;
}
return i;
}
</script>
</head>
<body onload="startTime()">
<div id="txt"></div>
</body>
</html>
OUTPUT
Math
<html>
<body>
<script type="text/javascript">
</script>
</body>
</html>
OUTPUT
History
<html>
<head>
<script type="text/javascript">
function goBack()
{
window.history.back()
}
function goForward()
{
window.history.forward()
}
function goBack()
{
window.history.go(-2)
}
document.write("Number of URLs in history list: " + history.length);
</script>
</head>
<body>
<input type="button" value="Back" onclick="goBack()" />
<input type="button" value="Go back 2 pages" onclick="goBack()" />
<input type="button" value="Forward" onclick="goForward()" />
</body>
</html>
OUTPUT
<html>
<body>
<script type="text/javascript">
carObj={name:"Ferrari",cost:"2 crore",owner:"Shelton",color:"Black"}
document.write(" The " +carObj.color + " " + carObj.name + " belongs to" + " " + carObj.owner);
</script>
</body>
</html>
OUTPUT
Write a code to implement form validation using Javascript.
<html>
<head>
<script type="text/javascript">
function validateForm()
{
alert("hi")
if (document.myForm.fname.value==null || document.forms["myForm"]["fname"].value=="")
{
alert("First name must be filled out");
return false;
}
if (document.myForm.Age.value==null || document.forms["myForm"]["Age"].value=="")
{
alert("Age must be filled out");
return false;
}
if (document.forms["myForm"]["Address"].value==null || document.forms["myForm"]["Address"].value=="")
{
alert("Address must be filled out");
return false;
}
if (document.forms["myForm"]["email"].value==null || document.forms["myForm"]["email"].value=="")
{
alert("E must be filled out");
return false;
}
if (document.forms["myForm"]["email"].value!=null)
{
var x=document.forms["myForm"]["email"].value
var atpos=x.indexOf("@");
var dotpos=x.lastIndexOf(".");
if (atpos<1 || dotpos<atpos+2 || dotpos+2>=x.length)
{
alert("Not a valid e-mail address");
return false;
}
}
return true;
}
</script>
</head>
<body>
OUTPUT
import java.sql.*;
/output
C:\jdk1.3\bin>javac JDBCAccessDemo.java
C:\jdk1.3\bin>java JDBCAccessDemo
Rows Effected by this query = 1
C:\jdk1.3\bin>
About
A language mapping requires the developer to create IDL code that represents the
interfaces to his objects. Typically, a CORBA implementation comes with a tool
called an IDL compiler which converts the user's IDL code into some language-
specific generated code. A traditional compiler then compiles the generated code to
create the linkable-object files for the application. This diagram illustrates how the
generated code is used within the CORBA infrastructure:
OMG trademarks
CORBA, IIOP and OMG are the registered marks of the Object Management
Group and should be used with care. However, GIOP (General Inter-ORB
Protocol) is not a registered OMG trademark. Hence in some cases it may be
more appropriate just to say that the application uses or implements the
GIOP-based architecture.
Objects By Reference
Object references are lightweight objects matching the interface of the real object
(remote or local). Method calls on the reference result in subsequent calls to the
ORB and blocking on the thread while waiting for a reply, success or failure. The
parameters, return data (if any), and exception data are marshaled internally by
the ORB according to the local language and OS mapping.
Data By Value
The CORBA Interface Definition Language provides the language- and OS-neutral
inter-object communication definition. CORBA Objects are passed by reference,
while data (integers, doubles, structs, enums, etc.) are passed by value. The
combination of Objects by reference and data-by-value provides the means to
enforce strong data typing while compiling clients and servers, yet preserve the
flexibility inherent in the CORBA problem-space.
Apart from remote objects, the CORBA and RMI-IIOP define the concept of the OBV
and Valuetypes. The code inside the methods of Valuetype objects is executed
locally by default. If the OBV has been received from the remote side, the needed
code must be either a priori known for both sides or dynamically downloaded from
the sender. To make this possible, the record, defining OBV, contains the Code Base
that is a space-separated list of URLs from where this code should be downloaded.
The OBV can also have the remote methods.
The OBVs may have fields that are transferred when the OBVs are transferred.
These fields can be OBVs themselves, forming lists, trees or arbitrary graphs. The
OBVs have a class hierarchy, including multiple inheritance and abstract classes.
The CCM has a component container, where software components can be deployed.
The container offers a set of services that the components can use. These services
include (but are not limited to) notification, authentication, persistence and
transaction processing. These are the most-used services any distributed system
requires, and, by moving the implementation of these services from the software
components to the component container, the complexity of the components is
dramatically reduced.
Portable interceptors
Portable interceptors are the "hooks", used by CORBA and RMI-IIOP to mediate the
most important functions of the CORBA system. The CORBA standard defines the
following types of interceptors:
1. IOR interceptors mediate the creation of the new references to the remote
objects, presented by the current server.
2. Client interceptors usually mediate the remote method calls on the client
(caller) side. If the object Servant exists on the same server where the
method is invoked, they also mediate the local calls.
3. Server interceptors mediate the handling of the remote method calls on the
server (handler) side.
The interceptors can attach the specific information to the messages being sent and
IORs being created. This information can be later read by the corresponding
interceptor on the remote side. Interceptors can also throw forwarding exceptions,
redirecting request to another target.
Each standard CORBA exception includes a minor code to designate the subcategory
of the exception. Minor exception codes are of type unsigned long and consist of a
20-bit “Vendor Minor Codeset ID” (VMCID), which occupies the high order 20 bits,
and the minor code proper which occupies the low order 12 bits.
Minor codes for the standard exceptions are prefaced by the VMCID assigned to
OMG, defined as the unsigned long constant CORBA::OMGVMCID, which has the
VMCID allocated to OMG occupying the high order 20 bits. The minor exception
codes associated with the standard exceptions that are found in Table 3-13 on page
3-58 are or-ed with OMGVMCID to get the minor code value that is returned in the
ex_body structure (see Section 3.17.1, “Standard Exception Definitions,” on page
3-52 and Section 3.17.2, “Standard Minor Exception Codes,” on page 3-58).
Within a vendor assigned space, the assignment of values to minor codes is left to
the vendor. Vendors may request allocation of VMCIDs by sending email to
tagrequest@omg.org.
The VMCID 0 and 0xfffff are reserved for experimental use. The VMCID OMGVMCID
(Section 3.17.1, “Standard Exception Definitions,” on page 3-52) and 1 through 0xf
are reserved for OMG use.
The Common Object Request Broker: Architecture and Specification (CORBA 2.3)
All CORBA products must support two OMG-defined URLs: "corbaloc:" and
"corbaname:". The purpose of these is to provide a human readable and editable
way to specify a location where an IOR can be obtained.
corbaloc::160.45.110.41:38693/StandardNS/NameServer-POA/_root
A CORBA product may optionally support the "http:", "ftp:" and "file:" formats. The
semantics of these is that they provide details of how to download a stringified IOR
(or, recursively, download another URL that will eventually provide a stringified
IOR). Some ORBs do deliver additional formats which are proprietary for that ORB.
Benefits
CORBA aims to bring to the table many benefits that no other single technology
brings in one package. These benefits include language- and OS-independence,
freedom from technology-linked implementations, strong data-typing, high level of
tunability, and freedom from the details of distributed data transfers.
Language Independence
CORBA at the outset was designed to free engineers from the hang-ups and
limitations of considering their designs based on a particular software language.
Currently there are many languages supported by various CORBA providers, the
most popular being Java and C++. There are also C-only, SmallTalk, Perl, Ada,
Ruby, and Python implementations, just to mention a few.
OS Independence
CORBA's design is meant to be OS-independent. CORBA is available in Java (OS-
independent), as well as natively for Linux/Unix, Windows, Sun, Mac and others.
High Tune-ability
There are many implementations available (e.g. OmniORB (Open source C++ and
Python implementation)) that have many options for tuning the threading and
connection management features. Not all implementations provide the same
features. This is up to the implementor.
Compression
CORBA marshals its data in a binary form and supports compression. IONA,
Remedy IT and Telefónica have worked on an extension to the CORBA standard that
delivers compression. This extension is called ZIOP and this is now a formal OMG
standard.
Implementation incompatibilities
The initial specifications of CORBA defined only the IDL, not the on-the-wire format.
This meant that source-code compatibility was the best that was available for
several years.
Location transparency
CORBA's notion of location transparency has been criticized; that is, that objects
residing in the same address space and accessible with a simple function call are
treated the same as objects residing elsewhere (different processes on the same
machine, or different machines). This notion is flawed if one requires all local
accesses to be as complicated as the most complex remote scenario. However,
CORBA does not place a restriction on the complexity of the calls. Many
implementations provide for recursive thread/connection semantics. I.e. Obj A calls
Obj B, which in turn calls Obj A back, before returning.
The creation of the CORBA standard is also often cited for its process of design by
committee. There was no process to arbitrate between conflicting proposals or to
decide on the hierarchy of problems to tackle. Thus the standard was created by
taking a union of the features in all proposals with no regard to their coherence.
This made the specification very complex, expensive to implement entirely and
often ambiguous.
A design committee composed largely of vendors of the standard implementation,
created a disincentive to make a comprehensive standard. This was because
standards and interoperability increased competition and eased customers'
movement between alternative implementations. This led to much political fighting
within the committee, and frequent releases of revisions of the CORBA standard
that were impossible to use without proprietary extensions.
Firewalls
CORBA (more precisely, IIOP) uses raw TCP/IP connections in order to transmit
data. However, if the client is behind a very restrictive firewall or transparent proxy
server environment that only allows HTTP connections to the outside through port
80, communication may be impossible, unless the proxy server in question allows
the HTTP CONNECT method or SOCKS connections as well. At one time, it was
difficult even to force implementations to use a single standard port — they tended
to pick multiple random ports instead. As of today, current ORBs do have these
deficiencies. Due to such difficulties, some users have made increasing use of web
services instead of CORBA. These communicate using XML/SOAP via port 80, which
is normally left open or filtered through a HTTP proxy inside the organization, for
web browsing via HTTP. Recent CORBA implementations, though, support SSL and
can be easily configured to work on a single port. Most of the popular open source
ORBS, such as TAO and JacORB also support bidirectional GIOP, which gives CORBA
the advantage of being able to use callback communication rather than the polling
approach characteristic of web service implementations. Also, more CORBA-friendly
firewalls are now commercially available.
Name: Shelton Nazareth
Class - SE-INFT-B
Roll no: 36
Batch-2
import java.io.*;
import java.math.*;
import java.util.*;
class BF
{
public static void main(String args[])throws IOException
{
// Initialization
BufferedReader br=new
BufferedReader(new InputStreamReader(System.in));
int di=100,ds=0;
int k,s,t;
int mat[][],i,j,node,root,pl[],tl[],count;
char a,b,m;
// Enter the number of Nodes & create the Graph matrix of size (node,node)
for(t=0,m='A';t<node;t++)
{
System.out.print("\t"+ m);
m++;
}
System.out.println("\n");
//Vertical Display of Nodes & entries of matrix
for(i=0,a='A';i<node;i++,a++)
{
System.out.print(a);
for(j=0;j<node;j++)
{
System.out.print("\t"+mat[i][j]);
}
System.out.println("\n");
}
tl=new int[node];
int wt=0;
for(i=0;i<node;i++)
tl[i]=mat[root][i];
for(j=0;j<node;j++)
{
for(count=1;count<node;count++)
{
for(i=0;i<node;i++)
{
wt=tl[count]+mat[count][i];
tl[i]=Math.min(tl[i],wt);
}
}
}
// Display the optimum path cost from Given source Node
/*OUTPUT:
Enter Number of Nodes:5
A 0 6 99 7 99
B 99 0 5 8 -4
C 99 -2 0 99 99
D 99 99 -3 0 9
E 2 99 7 99 0
A(0)
B(2)
C(4)
D(7)
E(-2)
Name: Shelton Nazareth
Class - SE-INFT-B
Roll no: 36
Batch-2
UDP Client
import java.io.*;
import java.net.*;
class UDPC
{
public static void main (String args[ ]) throws Exception
{
BufferedReader inFromUser = new BufferedReader(new InputStreamReader(System.in));
DatagramSocket clientSocket = new DatagramSocket( ); //a datagramsocket object is created
InetAddress IPAddress = InetAddress.getByName("192.168.1.45"); //an object of InetAddress
created
byte[ ] sendData = new byte[1024]; //an array of the type btye is created
byte[ ] receiveData = new byte[1024]; //an array of the type btye is created
System.out.println("IP Address:"+IPAddress+"\tPort:"); //ipaddress and port is displayed
System.out.println("Type something and press <Enter>\n");
String sentence = inFromUser.readLine(); //data entered by client
sendData = sentence.getBytes(); //data is stored in sendData
DatagramPacket sendPacket = new DatagramPacket (sendData,sendData.length, IPAddress, 5000);
//specifies a target address and port, which are used by a DatagramSocket to determine where the data in the
packet will be sent
clientSocket.send(sendPacket); //data is being send
System.out.println("Sending line to server...");
DatagramPacket receivePacket = new DatagramPacket(receiveData, receiveData.length); //reply is
received in datagramPackets
clientSocket.receive(receivePacket);
String modifiedSentence = new String(receivePacket.getData()); //converted into string
System.out.println("FROM SERVER:" + modifiedSentence); //displayed
clientSocket.close(); //client socket is closed
}
}
UDP Server
import java.io.*;
import java.net.*;
class UDPS
{
public static void main (String args[ ]) throws Exception
{
DatagramSocket serverSocket = new DatagramSocket(5000); //a datagramsocket object is created
System.out.println("Waiting for client");
byte[ ] receiveData = new byte[1024]; //an array of the type btye is created
byte[ ] sendData = new byte[1024]; //an array of the type btye is created
while(true)
{
DatagramPacket receivePacket = new DatagramPacket(receiveData,
receiveData.length); //data is received in datagramPackets
serverSocket.receive(receivePacket);
System.out.println("Got a client");
String sentence = new String(receivePacket.getData());
//converted into string
System.out.println("Client has sent this:"+ sentence); //displayed
InetAddress IPAddress = receivePacket.getAddress(); //an object of InetAddress created
int port = receivePacket.getPort(); //Returns the port number
String capitalizedSentence = sentence.toUpperCase(); //data is capitalised
sendData = capitalizedSentence.getBytes(); //data is stored in sendData
DatagramPacket sendPacket = new DatagramPacket(sendData, sendData.length, IPAddress,
port); //specifies a target address and port, which are used by a DatagramSocket to determine where the data in
the packet will be sent
System.out.println("Enter to send back:");
System.out.println("Sending it back");
serverSocket.send(sendPacket); //reply is sent
System.out.println("Waiting for next line");
}
}
}
OUTPUT:
Client side:
D:\NOTES\Sem-4\NTDD\UDP>set path=C:\Program Files\Java\jdk1.6.0\bin
D:\NOTES\Sem-4\NTDD\UDP>javac UDPC.java
D:\NOTES\Sem-4\NTDD\UDP>java UDPC
IP Address:/192.168.1.45 Port:5000
Type something and press <Enter>
Hi
Sending line to server...
FROM SERVER:HI
D:\NOTES\Sem-4\NTDD\UDP>java UDPC
IP Address:/192.168.1.45 Port:
Type something and press <Enter>
How r u?
Sending line to server...
FROM SERVER:HOW R U?
D:\NOTES\Sem-4\NTDD\UDP>java UDPC
IP Address:/192.168.1.45 Port:
Type something and press <Enter>
Server side:
D:\NOTES\Sem-4\NTDD\UDP>javac UDPS.java
D:\NOTES\Sem-4\NTDD\UDP>java UDPS
Waiting for client
Got a client
Client has sent this:Hi
Enter to send back:
Sending it back
Waiting for next line
Got a client
Client has sent this:How r u?
Hello.java
import java.rmi.*;
import java.rmi.server.*;
HelloClient.java
import java.rmi.Naming;
HelloInterface.java
import java.rmi.*;
public interface HelloInterface extends Remote {
public String say() throws RemoteException;
}
HelloServer.java
import java.rmi.Naming;
OUTPUT
C:\Program Files\Java\jdk1.6.0_16\bin>