WebForm

ASP开发方式

格式

<%  %> C#代码可以写在里面

<%= %>  往外输出一个值,可以放一个变量,一个方法(这个方法是有返回值的直接打印到界面上去)

<%@ %> 声明命名空间,语言时用的

示例:在网页中显示当前时间

复制代码
<%@ Language="C#" %>

<html>
<head></head>
<body>
<%=DateTime.Now.ToString() %>

<% if(DateTime.Now.Hour>12) 
{%>
下午
<%
}
else
{
%>
上午
<%}%>

</body>
</html>
复制代码

复习HTML中十二个表单元素:
文本类:
文本框 - <input type="text"/>
密码框 - <input type="password"/>
文本域 - <textarea></textarea>
隐藏域 - <input type="hidden"/>

按钮类:
普通按钮 - <input type="button"/>
提交按钮 - <input type="submit"/>
重置按钮 - <input type="reset"/>
图片按钮 - <input type="image" src="" />

选择类:
复选框 - <input type="checkbox" />
单选框 - <input type="radio"/>
下拉列表 - <select> <option></option> </select>
文件选择 - <input type="file"/>

 <form>
        <!--文本类-->
        <input type="text" /><br /><!--文本框-->
        <input type="password" /><br /><!--密码框-->
        <input type="hidden" /><br /><!--隐藏域-->
        <textarea></textarea><br /><!--文本域-->

        <!--按钮类-->
        <input type="button" value="普通按钮" /><!--普通按钮--><br />
        <input type="submit" /><!--提交按钮--><br />
        <input type="reset" /><!--重置按钮--><br />
        <input type="image" /><!--图片按钮--><br />

        <!--选择类-->
        <input type="radio" name="sex" id="ra1"/><label for="ra1"></label>                <!--单选框--><br />
        <input type="radio" name="sex" id="ra2"/><label for="ra2"></label>


        <input type="checkbox" /><!--复选框--><br />
        <select>
            <!--下拉列表-->
            <option>1</option>
            <option>2</option>
        </select>
        <input type="file" /><!--选择文件--><br />

    </form>

文件—打开—网站选中文件夹

含有 runat="server" 属性的元素为控件          尘暮

控件最后都会变成 HTML元素

原文地址:https://www.cnblogs.com/1030351096zzz/p/6227189.html