Showing posts with label ASP.Net with VBScript. Show all posts
Showing posts with label ASP.Net with VBScript. Show all posts

Thursday, February 23, 2012

Case implementation in VBScript


Case in VB script program.(Only IE)

 When form will load into browser window the onload event will call greeting() function .




<html>
<head runat="server">
    <title>Untitled Page</title>
    <script type="text/vbscript">
Function greeting()

d=weekday(date)
Select Case d
  Case 1
    document.write("Sleepy Sunday")
  Case 2
    document.write("Monday again!")
  Case 3
    document.write("Just Tuesday!")
  Case 4
    document.write("Wednesday!")
  Case 5
    document.write("Thursday...")
  Case 6
    document.write("Finally Friday!")
  Case else
    document.write("Super Saturday!!!!")
End Select

End Function
</script>
   
</head>
<body onload="greeting()">
    <form id="form1" runat="server">
    <div>


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

Function in VBScript language


VB script function is very similar with VB and JavaScript function. The function will call when the form will load into browser window.



<html>
<head runat="server">
    <title>Untitled Page</title>
    <script type="text/vbscript">
Function greeting()
i=hour(time)
If i < 10 Then
  document.write("Good morning!")
Else
  document.write("Have a nice day!")
End If
End Function
</script>
   
</head>
<body onload="greeting()">
    <form id="form1" runat="server">
    <div>
  
    </div>
    </form>
</body>
</html>

Prompt window using VB Script


VB script is a client side programming language. VB script is introduced by Microsoft .And only Microsoft web browser Internet Explorer support it. It is very similar with JavaScript which was introduced by Netscape navigator. VB script is not so popular as javaScript because of it’s narrow browser support.
You can place VBScript program in body and head section both.


This program will open a pop up window in browser


<html>
<head>
<script type="text/vbscript">
function myFunction()
   alert("Hello World!")
end function
</script>
</head>

<body>
<button onclick="myFunction()">Click me</button>
<script type="text/vbscript">
document.write("This message is written by VBScript")
</script>
</body>
</html>