HTML,DHTML,XML,XML DATA BINDING PROGRAMS

23
1. <html> <head> <title>TIME TABLE</title> </head> <body> <table border="2"> <tr> <th>&nbsp&nbsp&nbsp&nbsp</th> <th>1<snp>st</snp><br> hour</th> <th>2<snp>st</snp><br> hour</th> <th>3<snp>st</snp><br> hour</th> <th rowspan="7">B<br>R<br>E<br>A<br>K<br></th> <th>4<snp>st</snp><br> hour</th> <th>5<snp>st</snp><br> hour</th> <th>6<snp>st</snp><br> hour</th> </tr> <tr> <th>MON</th> <td>&nbsp&nbsp&nbsp&nbsp</td> <td>&nbsp&nbsp&nbsp&nbsp</td> <td>&nbsp&nbsp&nbsp&nbsp</td> <td>&nbsp&nbsp&nbsp&nbsp</td> <td>&nbsp&nbsp&nbsp&nbsp</td> <td>&nbsp&nbsp&nbsp&nbsp</td> </tr> <tr> <th>TUS</th> <td>&nbsp&nbsp&nbsp&nbsp</td> <td>&nbsp&nbsp&nbsp&nbsp</td> <td>&nbsp&nbsp&nbsp&nbsp</td> <td>&nbsp&nbsp&nbsp&nbsp</td> <td>&nbsp&nbsp&nbsp&nbsp</td> <td>&nbsp&nbsp&nbsp&nbsp</td> </tr> <tr> <th>WED</th> <td>&nbsp&nbsp&nbsp&nbsp</td> <td>&nbsp&nbsp&nbsp&nbsp</td> <td>&nbsp&nbsp&nbsp&nbsp</td> <td>&nbsp&nbsp&nbsp&nbsp</td> <td>&nbsp&nbsp&nbsp&nbsp</td> <td>&nbsp&nbsp&nbsp&nbsp</td> </tr> <tr> <th>THU</th> <td>&nbsp&nbsp&nbsp&nbsp</td>

description

OU BCOM 3rd Year programs in VBSCRIPT,HTML,XML,DHTML

Transcript of HTML,DHTML,XML,XML DATA BINDING PROGRAMS

Page 1: HTML,DHTML,XML,XML DATA BINDING PROGRAMS

1.<html><head> <title>TIME TABLE</title> </head><body><table border="2"><tr> <th>&nbsp&nbsp&nbsp&nbsp</th> <th>1<snp>st</snp><br> hour</th> <th>2<snp>st</snp><br> hour</th> <th>3<snp>st</snp><br> hour</th> <th rowspan="7">B<br>R<br>E<br>A<br>K<br></th> <th>4<snp>st</snp><br> hour</th> <th>5<snp>st</snp><br> hour</th> <th>6<snp>st</snp><br> hour</th></tr><tr> <th>MON</th> <td>&nbsp&nbsp&nbsp&nbsp</td> <td>&nbsp&nbsp&nbsp&nbsp</td> <td>&nbsp&nbsp&nbsp&nbsp</td> <td>&nbsp&nbsp&nbsp&nbsp</td> <td>&nbsp&nbsp&nbsp&nbsp</td> <td>&nbsp&nbsp&nbsp&nbsp</td></tr><tr> <th>TUS</th> <td>&nbsp&nbsp&nbsp&nbsp</td> <td>&nbsp&nbsp&nbsp&nbsp</td> <td>&nbsp&nbsp&nbsp&nbsp</td> <td>&nbsp&nbsp&nbsp&nbsp</td> <td>&nbsp&nbsp&nbsp&nbsp</td> <td>&nbsp&nbsp&nbsp&nbsp</td></tr><tr> <th>WED</th> <td>&nbsp&nbsp&nbsp&nbsp</td> <td>&nbsp&nbsp&nbsp&nbsp</td> <td>&nbsp&nbsp&nbsp&nbsp</td> <td>&nbsp&nbsp&nbsp&nbsp</td> <td>&nbsp&nbsp&nbsp&nbsp</td> <td>&nbsp&nbsp&nbsp&nbsp</td></tr><tr> <th>THU</th> <td>&nbsp&nbsp&nbsp&nbsp</td> <td>&nbsp&nbsp&nbsp&nbsp</td> <td>&nbsp&nbsp&nbsp&nbsp</td> <td>&nbsp&nbsp&nbsp&nbsp</td> <td>&nbsp&nbsp&nbsp&nbsp</td> <td>&nbsp&nbsp&nbsp&nbsp</td></tr><tr> <th>FRI</th> <td>&nbsp&nbsp&nbsp&nbsp</td> <td>&nbsp&nbsp&nbsp&nbsp</td>

Page 2: HTML,DHTML,XML,XML DATA BINDING PROGRAMS

<td>&nbsp&nbsp&nbsp&nbsp</td> <td>&nbsp&nbsp&nbsp&nbsp</td> <td>&nbsp&nbsp&nbsp&nbsp</td> <td>&nbsp&nbsp&nbsp&nbsp</td></tr><tr> <th>SAT</th> <td>&nbsp&nbsp&nbsp&nbsp</td> <td>&nbsp&nbsp&nbsp&nbsp</td> <td>&nbsp&nbsp&nbsp&nbsp</td> <td>&nbsp&nbsp&nbsp&nbsp</td> <td>&nbsp&nbsp&nbsp&nbsp</td> <td>&nbsp&nbsp&nbsp&nbsp</td></tr></table></body></html>

OUTPUT:

2.<head> <title></title> </head><body><table border="2"> <tr> <th rowspan="3" colspan="2"><img src="D:\007.JPG" height="20" width="50"></th> <th colspan="4"></th>POPULATION </tr> <tr> <th colspan="2">STYLE 1</th> <th colspan="2">STYLE 2</th> </tr> <th>M</th> <th>F</th> <th>M</th> <th>F</th> <tr> <th rowspan="2">2005</th>

Page 3: HTML,DHTML,XML,XML DATA BINDING PROGRAMS

<th>lit</th> <td>&nbsp&nbsp</td> <td>&nbsp&nbsp</td>

<td>&nbsp&nbsp</td> <td>&nbsp&nbsp</td>

<tr><th>illit</th><td>&nbsp&nbsp</td><td>&nbsp&nbsp</td>

<td>&nbsp&nbsp</td> <td>&nbsp&nbsp</td></tr> <tr> <th rowspan="2">2006</th> <th>lit</th> <td>&nbsp&nbsp</td> <td>&nbsp&nbsp</td>

<td>&nbsp&nbsp</td> <td>&nbsp&nbsp</td>

<tr><th>illit</th><td>&nbsp&nbsp</td><td>&nbsp&nbsp</td>

<td>&nbsp&nbsp</td> <td>&nbsp&nbsp</td></tr> </table></body></html>

output:

3.write a vbscript program to divide 2 numbers and if the denominator is zero handle the error<html><head>

Page 4: HTML,DHTML,XML,XML DATA BINDING PROGRAMS

<title></title> </head><body><script language="vbscript">on error resume nextdim x,y,zx=10y=0z=x/yif(err.number<>0) thenmsgbox err.number & err.descriptionelse msgbox "result" end if</script></body></html>

output

4.web page to display 3 textboxes and applay at least 4 different styles to each textbox using Style attribute.<html><head> <title>text box using style attributes</title> <meta http-equiv="content-type" content="text/html;charset=UTF-8" /></head><body> <h1>text box using style attributes</h1>

<input type="text" style="color:red;font-weight:bold; white-space:10; font-family:courier"></input><br>

<input type="text" style="color:green; font-weight:italic;white-space:8;font-family:Times New Roman"></input><br>

<input type="text" style="color:blue;font-weight:normal;white-space:10;font-family:Arial;"></input></body></html>

Page 5: HTML,DHTML,XML,XML DATA BINDING PROGRAMS

6.Employee information form ,when the information is submitted, message should be displayed.<html><head> <title></title> </head><body><form method="post" action="http//:www.osmania.com/evr/bcom"> EMPLOYEE NAME :<input type="text" size="20"><br> FATHER NAME:<input type="text" size="20"><br> ADDRESS:<input type="text" size="20"><br> Date Of Birth:<input type="text" size="20" value="dd/mm/yyyy"></input><br> Gender:<input type="radio">male <input type="radio">femal<br> Company Name:<input type="text" size="20"><br> DESG:<input type="text" size="20"><br> SALARY:<input type="text" size="20"><br> <input type="submit" name="submit" value="submit"> <input type="reset" value="reset"></input></form></body></html>

Page 6: HTML,DHTML,XML,XML DATA BINDING PROGRAMS

12.vbscript program to find sum of digits of a given number

<html><head> <title></title></head><body><script language="vbscript">dim n,d,sumsum=0n=inputbox("enter a value")while(n>0) d=n mod 10 sum=sum+d n=n/10 wend msgbox sum</script></body></html>

13. vbscript program on select case to find the value of two numbers from +,-,*,/,%(MOD).

<html><head> <title></title> </head><body><script language="vbscript"> Dim a,b,c,d a=inputbox("enter a value") b=inputbox("enter a value") c=inputbox("enter + - * / % value")select case c case "+" msgbox(a+b) case "-" msgbox(a-b) case "*" msgbox(a*b) case "/" msgbox(a/b) case "%" msgbox(a MOD b) End select</script></body></html>

18.web page with external style sheet.Ex.css

body{background-color:red}h1{color:maroon;font-size:20pt}hr(color:navy}

Page 7: HTML,DHTML,XML,XML DATA BINDING PROGRAMS

p{font-size"11pt;margin-left:15px}a:link{color:green}a:visited{color:yellow}a:active{color:blue}

Externalstyle.html

<html><head> <link rel="stylesheet" href="ex.css"> </head><body><h1>THIS IS HEADER 1</h1><hr /><p>This is linking to a style sheet !</p><p><a href="http://www.w3school.com" target="_blank">this is a link</a></p></body></html>output:

19.vbscript program to handle string functions.

22.create a web page to display text with different style effects using embedded style sheets.

<html><head> </head><body><style type="text/css">h1{text-align:center;color:blue }h2{text-align:left;color:red }p{text-align:right;color:green }</style>EMBEDDED SYTLESHEET<h1>EVR COLLEGE</h1><h2>EVR COLLEGE</h2><p>evr college</p></body></html>

Page 8: HTML,DHTML,XML,XML DATA BINDING PROGRAMS

23.create web page to display the contents using style sheet and style classes.

<html><head><STYLE TYPE="text/css">P.hyper { font-size: 40pt; color: blue; position: relative; left: 50px; top: 20px}P.gurl { font-size: 50pt; color: green; position: relative; left: 65px; top: -55px;}</head></STYLE> <body><P class="hyper">I Just Love</P><P class="gurl">Overlapping Text</P></body></html>

25.web page to display different filter effects on text

<html><head> <title></title> <meta http-equiv="content-type" content="text/html;charset=UTF-8" /></head><body><h1 style="position:absolute;filter:glow()"> EVR COLLEGE</h1><br><br><br><h1 style="position:absolute;filter:shadow()"> EVR COLLEGE</h1></body>

Page 9: HTML,DHTML,XML,XML DATA BINDING PROGRAMS

</html>

26 web page to display image and apply transition effects on the image

<html><head> <title></title><style>div{width:160px;height:120px; }</style></head><body>alpha:<div style="filter:alpha(Opacity=20"><img src="D:\1.jpg" width="160" height="120" /></div>gray :<div style="filter:gray()"><img src="D:\1.jpg" width="160" height="120" /></div>invert :<div style="filter:invert()"><img src="D:\1.jpg" width="160" height="120" /></div>X-ray<div style="filter:xray()"><img src="D:\1.jpg" width="160" height="120" /></div></div></body></html>

output:

Page 10: HTML,DHTML,XML,XML DATA BINDING PROGRAMS

29.vbscript program to find reverse of the given number and check whether the number is palindrome or not

30.Multiplication table using vbscript<html><head> <title></title> <meta http-equiv="content-type" content="text/html;charset=UTF-8" /></head><body><script language="vbscript">dim i,nn=inputbox("enter a value")for i=1 to 10document.write(i&"*"&n&"="&n*i&"<br>")next</script></body></html>output:

Page 11: HTML,DHTML,XML,XML DATA BINDING PROGRAMS

31.vbscript program using array to display the name of 5 students

<html><body><script type="text/vbscript">dim famname(5)famname(0)="Shiva"famname(1)="Rajesh"famname(2)="Ajay"famname(3)="Rani"famname(4)="Sravai"famname(5)="Ramullamma"for i=0 to 5 document.write(famname(i) & "<br />")next</script></body></html>

output:

32.vbscript program to calculate the total cost of the articles purchase.

<html><head> <title>total cost</title><script type="text/vbscript">sub cmdcalculate_onClick Dim AmountofTax

Page 12: HTML,DHTML,XML,XML DATA BINDING PROGRAMS

Dim SubTotal Dim TAXRATE Dim TotalCost msgbox "click ok to calculate" TAXRATE=0.06 SubTotal=document.frm1.txtQuantity.value*document.frm1.txtUnitPrice.value AmountofTax = SubTotal*TAXRATE TotalCost = SubTotal+AmountofTax document.frm1.txtSubTotal.value = SubTotal document.frm1.txtTaxes.value = AmountofTax document.frm1.txtTotalCost.value = TotalCostEnd sub </script></head><body><form name="frm1"> Quntity:<input type="text" name="txtQuantity" size="5"></input><br />Unit Price: <input type="text" name="txtUnitPrice" size="5"></input><br /><br /><input type="button" name="cmdcalculate" value="Calculate Cost"></input><br /><br />SubTotal : <input type="text" name="txtSubTotal" size="5"></input><br />Taxes:<input type="text" name="txtTaxes" size="5"></input><br />TotalCost: <input type="text" name="txtTotalCost"></input>

</form></body></html>

output:

34.a)vbscript program to find factorial of given number<html><head> <title></title>

Page 13: HTML,DHTML,XML,XML DATA BINDING PROGRAMS

</head><body><script language="vbscript">dim n,f,if=1n=inputbox("enter a number")for i=1 to nf=f*inextmsgbox("factorial is "&f)</script></body></html>

b)vbscript program to genereate fibonacii no<html><head> <title></title> <meta http-equiv="content-type" content="text/html;charset=UTF-8" /></head><body><script language="vbscript">dim n,f1,f2,f3f1=0f2=1f3=f1+f2document.write(f1)document.write(f2)n=inputbox("enter n value")while(int(f3)<=int(n))document.write(f3)f1=f2f2=f3f3=f1+f2wend</script></body></html>

output:

enter a value:10

0 1 1 2 3 5 8

34.vb script program for Data Validation on fields in the student form.

<html><head><script language="vbscript">sub btn_onClickif IsNumeric(document.studfrm.txtname.value) then msgbox "char only" end ifif IsNumeric(document.studfrm.txtrollno.value) then msgbox "submitted"else

Page 14: HTML,DHTML,XML,XML DATA BINDING PROGRAMS

msgbox "enter no. only"end ifend sub</script> </head><body><form name="studfrm">Name :<input type="text" name="txtname" size="20"><br>Roll No.<input type="text" name="txtrollno" size="10"><br><input type="button" name="btn" value="submit"></form></body></html>

output:

38.displaying cursor position with relative positions.

<html><head> <title></title> <meta http-equiv="content-type" content="text/html;charset=UTF-8" /></head><body><p> move the mouse over the words to see the cursor change</p><span style="cursor:auto;">auto</span><br><span style="cursor:crosshair;">crosshair</span><br><span style="cursor:default;">default</span><br><span style="cursor:pointer;">pointer</span><br><span style="cursor:s-resize;">s-resize</span><br><span style="cursor: wait;">wait</span></body></html>

Page 15: HTML,DHTML,XML,XML DATA BINDING PROGRAMS

40.xml document with simple links.

<?xml version="1.0" ?><bookstore xmlns:xlink="http://www.w3.org/1999/xlink"><book title="Harry Potter"> <description xlink:type="simple" xlink:href="http://book.com/images/HPotter.gif" xlink:show="new"> As his fifth year at Hogwarts School of Witchcraft and Wizardry approaches, 15-year-old Harry Potter is....... </description></book></bookstore>

41.create a xml document and bind the data

employees.xml

<html><head> <title></title> </head><body><center><h1>using data islands with tables</h1><xml src="employee.xml" id=employees></xml><table Datasrc="#employees" cellspacing="6"> <thead> <tr> <th>Name</th> <th>Code NO.</th> <th>Joining date</th> <th>Department</th> </tr> </thead> <tbody> <tr> <td><span datafld="name" dataformatas="html"></span></td> <td><span datafld="codeno" dataformatas="html"></span></td>

Page 16: HTML,DHTML,XML,XML DATA BINDING PROGRAMS

<td><span datafld="doj" dataformatas="html"></span></td> <td><span datafld="dept" dataformatas="html"></span></td> </tr> </tbody></table></center></body></html>

employee.html

<html><head> <title></title> </head><body><center><h1>using data islands with tables</h1><xml src="employee.xml" id=employees></xml><table Datasrc="#employees" cellspacing="6"> <thead> <tr>

<th>Name</th> <th>Code NO.</th> <th>Joining date</th> <th>Department</th>

</tr> </thead> <tbody> <tr> <td><span datafld="name" dataformatas="html"></span></td> <td><span datafld="codeno" dataformatas="html"></span></td> <td><span datafld="doj" dataformatas="html"></span></td> <td><span datafld="dept" dataformatas="html"></span></td> </tr> </tbody></table></center></body></html>employee1.html:<html><head> <title></title> </head><body>

Page 17: HTML,DHTML,XML,XML DATA BINDING PROGRAMS

<center><h1>using singular databinding with single record binding</h1><xml src="employee.xml" id=employees></xml>Name :<input type="text" Datasrc="#employees" Datafld="name" size="10"></input><p>Code Number : <input type="text" Datasrc="#employees" Datafld="codeno" size="10"></input></p><p>Joining Date : <input type="text" Datasrc="#employees" Datafld="doj" size="10"></input></p><p>Department : <select Datasrc="#employees" Datafld="dept" size=5>

<option>shipping</option>

<option>packing</option>

<option>programmer</option>

</select></p><button onClick="employees.record.MoveFirst()">&lt;&lt;</button><button onClick="if(!employees.record.EOF)employee.recordset.MovePrevious()">&lt;</button><button onClick="if(employees.recordset.EOF)employee.recordset.MoveNext()">&gt;</button><button onCick="employee.recordset.MoveFirst()">&gt;&gt;</button></center></body></html>

output:

using data islands with tablesName Code NO. Joining date Department

tony 1234 4-1-1987 shippingtimmy 1225 14-11-2000 packingrimmy 1200 4-1-1990 programmer

45. write a vbscript program to generate N natural numbers and find the sum.

<html> <head><title>prog to generate n natural no. and their sum</title></head><script type="text/vbscript">dim i

Page 18: HTML,DHTML,XML,XML DATA BINDING PROGRAMS

dim sumdim nsum=0n=InputBox("enter n value")for i=1 to n document.write(i&"<br />") sum=sum+inextdocument.write("sum is"&sum)</script><body>

</body></html>

Output:

49. (i)write a vbscript program to calculate the sum of first 20 even numbers<html> <head><title>prog to generate n natural no. and their sum</title></head>

<body><script type="text/vbscript">dim i,sumsum=0for i=2 to 20 step 2 document.write(i&"<br />") sum=sum+inextdocument.write("sum is"&sum)</script></body></html>

(ii) write a vbscript program to check whether the given character is vowel or not.

Page 19: HTML,DHTML,XML,XML DATA BINDING PROGRAMS

<html> <head><title>prog to generate n natural no. and their sum</title></head><script type="text/vbscript">dim chch=InputBox("enter a character")if ch="a" or ch="e" or ch="i" or ch="o" or ch="u" then msgbox "vowel" else msgbox "not a vowel" end if </script><body>program to check given character is vowel or not</body></html>

output:enter a character (if you enter a e i o u) ---prints vowel in msgbox otherwise prints not vowel.

46.write a vbscript program to calculate the square, square root and cube of a value using function.

<html><head> <title></title> <script type="text/vbscript"> sub btn_onClick() dim val val = frm.txtnum.value Msgbox "square root :"&sqr(val) Msgbox "square is :"&val*val Msgbox "cube is :"&val*val*val end sub </script></head><body> <form name=frm> enter a number:<input type="text" name="txtnum"></input> <input type="button" name="btn" value="click"></input> </form></body></html>

Page 20: HTML,DHTML,XML,XML DATA BINDING PROGRAMS

Output: