一、简单控件

1、Label(作用:显示文字)

Web中:

<asp:Label ID="Label1" runat="server" Text="Label" BorderColor="Black" BorderStyle="Solid" BorderWidth="5px"></asp:Label>

编译完成后的元素时span(html)

<span >Label</span>

属性:①BackColor:控件背景色 ;

        ②BorderColor:控件边框颜色;

        ③BorderStyle:控件边框样式;

        ④BorderWidth:控件边框宽度

 

2、Literal(作用:显示文字)
Web中:

<asp:Literal ID="Literal1" runat="server" Text ="编译后不会形成什么元素"></asp:Literal>

编译后不会形成什么元素(一般用来后台输出js代码)

</div>
        编译后不会形成什么元素

3、TextBox(文字输入框)

属性:①TextMode:文本矿的行为模式,有以下几种模式:

★默认SingleLine:单行。

Web中:

<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>

编译后:

<input name="TextBox1" type="text"  />

★Password:密码框

Web中:

<asp:TextBox ID="TextBox1" runat="server" TextMode="Password"></asp:TextBox>

编译后:

<input name="TextBox1" type="password"  />

★Multiline:文本域

Web中:

<asp:TextBox ID="TextBox1" runat="server" TextMode="MultiLine"></asp:TextBox>

编译后textarea:

<textarea name="TextBox1" rows="2" cols="20" >

        ②warp:换行(true:换行;false:不换行)

        ③Enabled:控件启用状态

        ④Readonly:是否可以更改控件中的文本

        ⑤Maxlength:限制最长长度;比如:密码限制多少位,就可以更改此属性

4、按钮类

(1)Button:

Web中:

<asp:Button ID="Button1" runat="server" Text="Button" />

编译后submit:

<input type="submit" name="Button1" value="Button"  />

属性:Onclintclick:比如:在onclintclick后面加上alert("nihao");
编译后是:

<input type="submit" name="Button1" value="Button" onclick="alert(&quot;nihao&quot;);"  />

注:

<asp:Button ID="Button1" runat="server" Text="Button" OnClientClick='if(confirm("是否要提交?")){return false;}' />

Confirm():

       confirm() 方法用于显示一个带有指定消息和OK 及取消按钮的对话框。

  如果用户点击确定按钮,则confirm() 返回true。如果点击取消按钮,则confirm() 返回false。

  在用户点击确定按钮或取消按钮把对话框关闭之前,它将阻止用户对浏览器的所有输入。在调用confirm() 时,将暂停对JavaScript 代码的执行,在用户作出响应之前,不会执行下一条语句。

  下面我们通过这两个小例子,来了解一下它的使用方法吧:

<head>
<title>confrim 的使用方法</title>
<script type="text/javascript">
function clear1()
{
 if(confirm("确定要清空数据吗?"))
 {
 document.main.text1.value="";
 }
}
</script>
</head>
<boty>
<form name="main">
<input type="text" name="text1"/>
<input type="button" name="submit" value="数据清空" onclick="return clear1()"/>
</form>
</body>
confrim 的使用方法

相关文章:

  • 2021-11-05
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-16
  • 2021-12-04
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-01-21
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-25
相关资源
相似解决方案