一、变量

  1.1 声明变量

  dim name
  name="Donald Duck"
  response.write("My name is: " & name)
  1.2 声明数组

  Dim famname(5),i
  famname(0) = "Jan Egil"
  famname(1) = "Tove"
  famname(2) = "Hege"
  famname(3) = "Stale"
  famname(4) = "Kai Jim"
  famname(5) = "Borge"   For i = 0 to 5
      response.write(famname(i) & "<br>")
  Next 二、函数   2.1 VB

  <!DOCTYPE html>
  <html>
    <head>
      <%
        sub vbproc(num1,num2)
          response.write(num1*num2)
        end sub
      %>
    </head>
    <body>
      <p>Result: <%call vbproc(3,4)%></p>
    </body>
  </html>   2.2 JS

  将 <%@ language="language" %> 这一行写在 <html> 标签的上面,就可以使用另一种脚本语言来编写子程序或者函数:
  <%@ language="javascript" %>
  <!DOCTYPE html>
  <html>
    <head>
      <%
        function jsproc(num1,num2)
        {
          Response.Write(num1*num2)
        }
      %>
    </head>
    <body>
      <p>Result: <%jsproc(3,4)%></p>
    </body>
  </html>
  
  2.3 在一个 ASP 文件中调用 VBScript 子程序和 JavaScript 子程序
  
  <!DOCTYPE html>
  <html>
    <head>
      <%
        sub vbproc(num1,num2)
          Response.Write(num1*num2)
        end sub
      %>
      <script  language="javascript" runat="server">
        function jsproc(num1,num2)
        {
          Response.Write(num1*num2)
        }
      </script>
    </head>
    <body>
      <p>Result: <%call vbproc(3,4)%></p>
      <p>Result: <%call jsproc(3,4)%></p>
    </body>
  </html>
三、表单

  3.1 GET表单(index.asp)

  <!DOCTYPE html>
  <html>
    <body>
      <form action="index.asp" method="get">
        Your name: <input type="text" name="fname" size="20" />
        <input type="submit" value="Submit" />
      </form>
      <%
        dim fname
        fname=Request.QueryString("fname")
        If fname<>"" Then
            Response.Write("Hello " & fname & "!<br>")
            Response.Write("How are you today?")
        End If
      %>
    </body>
  </html>
  
  
3.2 POST表单(index.asp)
  
  <!DOCTYPE html>
  <html>
    <body>
      <form action="demo_simpleform.asp" method="post">
        Your name: <input type="text" name="fname" size="20" />
        <input type="submit" value="Submit" />
      </form>
      <%
        dim fname
        fname=Request.Form("fname")
        If fname<>"" Then
            Response.Write("Hello " & fname & "!<br>")
            Response.Write("How are you today?")
        End If
      %>
    </body>
  </html>
四、Cookie
  
  4.1 创建cookie
  <%
    Response.Cookies("firstname")="Alex"
    Response.Cookies("firstname").Expires=#May 10,2012#
  %>   4.2 取回cookie
  <%
    fname=Request.Cookies("firstname")
    response.write("Firstname=" & fname)
  %>   4.3 带有键的cookie
  <%
    Response.Cookies("user")("firstname")="John"
    Response.Cookies("user")("lastname")="Smith"
    Response.Cookies("user")("country")="Norway"
    Response.Cookies("user")("age")="25"
  %>   4.4 读取所有cookie
  I. 被读取的cookie
  <%
    Response.Cookies("firstname")="Alex"
    Response.Cookies("user")("firstname")="John"
    Response.Cookies("user")("lastname")="Smith"
    Response.Cookies("user")("country")="Norway"
    Response.Cookies("user")("age")="25"
  %>
  II. 读取cookie
  <!DOCTYPE html>
  <html>
    <body>     <%
      dim x,y
      for each x in Request.Cookies
        response.write("<p>")
        if Request.Cookies(x).HasKeys then
          for each y in Request.Cookies(x)
            response.write(x & ":" & y & "=" & Request.Cookies(x)(y))
            response.write("<br>")
          next
        else
          Response.Write(x & "=" & Request.Cookies(x) & "<br>")
        end if
        response.write "</p>"
      next
    %>     </body>
  </html>

ASP学习笔记1的更多相关文章

  1. ASP.Net开发基础温故知新学习笔记

    申明:本文是学习2014版ASP.Net视频教程的学习笔记,仅供本人复习之用,也没有发布到博客园首页. 一.一般处理程序基础 (1)表单提交注意点: ①GET通过URL,POST通过报文体: ②需在H ...

  2. ASP.Net MVC开发基础学习笔记:一、走向MVC模式

    一.ASP.Net的两种开发模式 1.1 ASP.Net WebForm的开发模式 (1)处理流程 在传统的WebForm模式下,我们请求一个例如http://www.aspnetmvc.com/bl ...

  3. ASP.Net MVC开发基础学习笔记(1):走向MVC模式

    一.ASP.Net的两种开发模式 1.1 ASP.Net WebForm的开发模式 (1)处理流程 在传统的WebForm模式下,我们请求一个例如http://www.aspnetmvc.com/bl ...

  4. ASP.NET MVC Web API 学习笔记---第一个Web API程序

    http://www.cnblogs.com/qingyuan/archive/2012/10/12/2720824.html GetListAll /api/Contact GetListBySex ...

  5. [ASP.NET MVC] ASP.NET Identity学习笔记 - 原始码下载、ID型别差异

    [ASP.NET MVC] ASP.NET Identity学习笔记 - 原始码下载.ID型别差异 原始码下载 ASP.NET Identity是微软所贡献的开源项目,用来提供ASP.NET的验证.授 ...

  6. 【Ext.Net学习笔记】01:在ASP.NET WebForm中使用Ext.Net

    Ext.NET是基于跨浏览器的ExtJS库和.NET Framework的一套支持ASP.NET AJAX的开源Web控件,包含有丰富的Ajax运用,其前身是Coolite. 下载地址:http:// ...

  7. 精通ASP.Net MVC 3 框架(第三版)学习笔记

    精通ASP.Net MVC 3 框架(第三版)学习笔记 代码才是王道. http://pan.baidu.com/s/1pJyL1cn

  8. Ext.Net学习笔记01:在ASP.NET WebForm中使用Ext.Net

    Ext.Net是一个对ExtJS进行封装了的.net控件库,可以在ASP.NET WebForm和MVC中使用.从今天开始记录我的学习笔记,这是第一篇,今天学习了如何在WebForm中使用Ext.Ne ...

  9. ASP.NET Core Web开发学习笔记-1介绍篇

    ASP.NET Core Web开发学习笔记-1介绍篇 给大家说声报歉,从2012年个人情感破裂的那一天,本人的51CTO,CnBlogs,Csdn,QQ,Weboo就再也没有更新过.踏实的生活(曾辞 ...

随机推荐

  1. 4.Docker Compose 部署 Nexus

    什么是 Nexus Nexus 是一个强大的 Maven 仓库管理器,极大地简化了内部仓库的维护和外部仓库的访问.2016 年 4 月 6 日 Nexus 3.0 版本发布,相较 2.x 版本有了很大 ...

  2. C# 引入Sqlite 未能加载文件或程序集“System.Data.SQLite

    个人博客 地址:https://www.wenhaofan.com/article/20190501224046 问题 在Visual Studio 中 使用NuGet 通过 install-pack ...

  3. pymysql 连接池

    pymysql连接池 import pymysql from DBUtils.PooledDB import PooledDB, SharedDBConnection ''' 连接池 ''' clas ...

  4. psp 周计划2

    日期\时间 开始时间 结束时间 中断时间 净时间 活动 备注 12/3 9:00 11:30 10:30 120分钟 自习,练习 教室 14:00 16:30 15:30 80分钟 练习 中午休息 1 ...

  5. CSS-定义样式表

    1.HTML标记定义 p{属性:属性值;属性1:属性1} <p>...</p> 注:p可以叫做选择器,定义那个标记中的内容执行其中的样式.一个选择器可以控制若干个样式属性,他们 ...

  6. centos7添加多个网段

    # service network restart是重启所有网卡.例如下面的例子:>ifconfig eth0 up|down>service network restart|start| ...

  7. PP: Toeplitz Inverse Covariance-Based Clustering of Multivariate Time Series Data

    From: Stanford University; Jure Leskovec, citation 6w+; Problem: subsequence clustering. Challenging ...

  8. yolo系列阅读笔记(v1-v3)

    yolov1 模型输出的概率建模 图片首先被分割为S*S的网格(grid cell).如果一个bbox的中心落在一个网格里,则该网格负责检测该物体.(对于pascal数据集,S定为7) 每个网格预测B ...

  9. jQuery---jQuery对象与DOM对象的区别

    jQuery对象与DOM对象的区别 1. DOM对象:使用JavaScript中的方法获取页面中的元素返回的对象就是dom对象.2. jQuery对象:jquery对象就是使用jquery的方法获取页 ...

  10. dijkstra算法为什么不能处理带有负边权的图

      1 2 3 1 0 8 9 2 10 0 10 3 10 -2 0 先看样例再解释,看邻接矩阵会发现, 如果用dijkstra算1-2的最短路因为贪心思想所以得到的结果是8,但明显可以看到1-3- ...