VBScript can display different welcome words according to different time periods


In this example, the VBScript code calls the write method of the document object to pass a string. All operations are completed on the client side: there is no need to specify the server-side operation, no Perl trace, stable and clear!

Copy codeThe code is as follows:

‘execute this line when parsing script tags
     Call PrintWelcome


     Sub PrintWelcome
      Dim h
      h = Hour(Now)
      If h < 12 then
       Document. Write “good morning!”
      ElseIf h < 17 then
       Document. Write “good afternoon!”
       Document. Write “good evening!”
      End If
      Document. Write “welcome to the world of VBScript.”
      Document. Write “now”
      Document. Write date() & “& time() &”
     End Sub