Program 5 Write A Program To Compute The Arithmetic and Geometric Mean Using Vbscript
Program 5 Write A Program To Compute The Arithmetic and Geometric Mean Using Vbscript
<%@ Language =VBScript %> <% Option Explicit Dim iTerm1,iTerm2,SngArithmetic,SngGeometric %> <HTML> <BODY> <% iTerm1=5 iTerm2=16 Response.Write("we are computing the average of ") Response.Write(iTerm1) Response.Write(" and ") Response.Write(iTerm2) %> <BR> <% SngArithmetic=iTerm1+iTerm2 SngArithmetic=SngArithmetic/2 SngGeometric=(iTerm1*iTerm2)^0.5 Response.Write("Their arithmetic Mean is")
1709103 13
Response.Write(SngArithmetic) Response.Write(" and their geometric mean is ") Response.Write(SngGeometric) %> </BODY> </HTML>
Output:
1709103
14
Program 6 Write a Program to create a simple form using POST method. a) Simpleform.asp
<%@language=vbscript%> <%option Explicit%> <html> <body> <form method=post action="collectinfo.asp"> TextBox1: <input type=text name=textbox1> <br> TextBox2: <input type=text name=textbox2> <p>
1709103 15
b)
Collect info.asp
<% Dim text1,text2 text1=Request.Form("textbox1") text2=Request.Form("textbox2") Response.Write "TextBox1=" & text1 %> <br> <% Response.Write "TextBox2=" & text2 %>
1709103
16
Outputs: a)
b)
1709103
17
Program 7 Write a Program to create a session objects and retrive in other file. a) Sessionobj.asp
<%@language=vbscript%> <%option Explicit%> <% Dim sentence(4) sentence(0)="This " sentence(1)="is " sentence(2)="SSP " sentence(3)="Programming " sentence(4)="Lab."
1709103 18
Dim iloop For iloop=LBound(sentence) to UBound(sentence) Response.Write sentence(iloop) Next Session("sent")=sentence %>
b)
Session.asp
<%@language=vbscript%> <%option Explicit%> <% Dim iloop If IsArray(Session("sent")) then For iloop=LBound(Session("sent")) to UBound(Session("sent")) Response.Write Session("sent")(iloop) Next Else Response.Write("No sentence to process") End If %>
1709103 19
Outputs: a)
b)
1709103
20
c)
1709103
21
if nvisits=1 then response.write " time Before!" else response.write " times After!" end if end if %> <html> <body> </body> </html>
Output:
1709103
23
Program No 8 Write a program is ASP to check the capabilities of the browser using browser capability component.
<% language = vbscript %> <html> <body> <% Set MyBrow=Server.CreateObject("MSWC.BrowserType") %> <table border="1" width="65%"> <tr> <td width="52%">Client OS</td> <td width="48%"><%=MyBrow.platform%></td> </tr> <tr> <td >Web Browser</td> <td ><%=MyBrow.browser%></td> </tr> <tr> <td>Browser version</td>
1709103 24
<td><%=MyBrow.version%></td> </tr> <tr> <td>Frame support?</td> <td><%=MyBrow.frames%></td> </tr> <tr> <td>Table support?</td> <td><%=MyBrow.tables%></td> </tr> <tr> <td>Sound support?</td> <td><%=MyBrow.backgroundsounds%></td> </tr> <tr> <td>Cookies support?</td> <td><%=MyBrow.cookies%></td> </tr> <tr> <td>VBScript support?</td> <td><%=MyBrow.vbscript%></td> </tr> <tr> <td>JavaScript support?</td> <td><%=MyBrow.javascript%></td> </tr> </table> </body> </html>
1709103
25
Output:
1709103
26