VBScript基本使用

一.VBScript简介

VBScript 是微软公司出品的脚本语言。VBScript 是ASP (Active Server Pages)默认使用的脚本语言。

二.基本使用

1.输出


<!DOCTYPE html>
<html>
<body>

<script type="text/vbscript">

    document.write("hello world")

</script>

<p>A Function procedure can return a result.</p>

</body>
</html>

在这里插入图片描述

2.变量


<!DOCTYPE html>
<html>
<body>

<script type="text/vbscript">

    Dim name              // 声明变量
    name = "world"
    age = 18
    document.write(name & Chr(10) & age)

</script>

<p>A Function procedure can return a result.</p>

</body>
</html>

在这里插入图片描述

3.调用函数


<!DOCTYPE html>
<html>
<body>

<script type="text/vbscript">

    Function testfunction(a, b)
    c = a + b
    testfunction = a + c
    End Function

    document.write(testfunction(1,3))

</script>

<p>A Function procedure can return a result.</p>

</body>
</html>


在这里插入图片描述

4.条件语句

1.Select Case

<!DOCTYPE html>
<html>
<body>

<script type="text/vbscript">

    d=weekday(date)
    Select Case d             // Select Case
    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

</script>

<p>A Function procedure can return a result.</p>

</body>
</html>

在这里插入图片描述

2.If…Then…Else

<!DOCTYPE html>
<html>
<body>

<script type="text/vbscript">

    Function YLove(you)      // 程序 If ... Then ... Else

    If you = "love" Then
    result = "Let's get married"
    Else
    result = "But i love you"
    End If

    YLove = result
    End Function            // 程序结束      "<br />"  换行

    document.write(YLove("love") & "<br />" & YLove("not love"))

</script>

<p>A Function procedure can return a result.</p>

</body>
</html>

在这里插入图片描述

3.If … Then … ElseIf

<!DOCTYPE html>
<html>
<body>

<script type="text/vbscript">

    i=hour(time)

    If i = 10 Then
    document.write("Just started...!")
    ElseIf i = 11 Then
    document.write("Hungry!")
    ElseIf i = 12 Then
    document.write("Ah, lunch-time!")
    ElseIf i = 16 Then
    document.write("Time to go home!")
    Else
    document.write("Unknown")
    End If

</script>

<p>A Function procedure can return a result.</p>

</body>
</html>

在这里插入图片描述

5.循环

1. For … Next

<!DOCTYPE html>
<html>
<body>

<script type="text/vbscript">

    For i = 0 To 3
    document.write("The number is " & i & "<br />")
    Next

</script>

<p>A Function procedure can return a result.</p>

</body>
</html>

在这里插入图片描述

2. For Each … Next

<!DOCTYPE html>
<html>
<body>

<script type="text/vbscript">

    Dim cars(2)
    cars(0)="Volvo"
    cars(1)="Saab"
    cars(2)="BMW"

    For Each x In cars
    document.write(x & "<br />")
    Next

</script>

<p>A Function procedure can return a result.</p>

</body>
</html>

在这里插入图片描述

3. Do While … Loop

<!DOCTYPE html>
<html>
<body>

<script type="text/vbscript">

    i = 16
    Do While i>10
    i = i - 2
    document.write("this i is number " & i & "<br />")
    Loop

</script>

<p>A Function procedure can return a result.</p>

</body>
</html>

在这里插入图片描述

以上所有实例皆可以在 windows 系统创建 .hta 文件双击运行

  • 4
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
SecureCRT的基本使用如下: 1. 下载和安装:从VanDyke Software官方网站下载SecureCRT的安装程序,并按照提示进行安装。 2. 创建会话:打开SecureCRT后,点击"Quick Connect"按钮或选择"File"菜单中的"Quick Connect"选项,输入远程主机的地址、用户名和密码,选择连接协议(如SSH或Telnet),然后点击"Connect"按钮。 3. 会话管理:SecureCRT提供了会话管理功能,可以保存和管理多个远程主机的连接设置。在主界面点击"File"菜单中的"Connect"选项,可以打开会话管理器,通过添加、删除、编辑会话来管理连接设置。 4. 远程访问:一旦连接成功,SecureCRT将打开一个新的窗口,显示远程主机的命令行界面。您可以在该窗口中执行命令、编辑文件、进行文件传输等操作。 5. 文件传输:SecureCRT内置了文件传输功能,可用于在本地计算机和远程主机之间进行文件传输。您可以使用菜单栏的"File"选项来上传或下载文件。 6. 会话脚本:SecureCRT支持使用VBScript、JScript等脚本语言编写自定义脚本,以自动化一些重复性操作。您可以使用"Script"菜单中的选项来创建、编辑和运行会话脚本。 7. 配置和个性化:SecureCRT提供了丰富的配置选项,可以根据个人喜好进行自定义设置。您可以通过"Options"菜单中的选项来配置外观、字体、颜色、键盘映射等。 请注意,以上是SecureCRT的基本使用方法,更详细的功能和操作可以参考SecureCRT的官方文档或用户手册。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值