ASP Getting Started tutorials-working with other form controls

Source: Internet
Author: User
Tags reset

In addition to creating an input form control using the input tag, you can also use the TEXTAREA tag to create multiline text boxes, or to create Options menu using the Select Tag, and you can use the fieldset tag to group controls in the form.

1. Use multiple-line text box controls in a form

i) Format:

  <form name="表单的名称" method="get | post" action="URL">
  <TEXTAREA name="字符串" ROWS="整数" COLS="整数" [READONLY] >......</TEXTAREA>
  </form>

Note: The text entered in <TEXTAREA></TEXTAREA> will act as the initial value of the control.

II) Properties:

Multiple-line text boxes have the following properties (Table i)
Property Meaning
NAME

Specifies the name of a multiline text box.

ROW Specifies the number of rows for a multiline text box.
COLS Specifies the width, in string, of a multiline text box.
READONLY Specifies that multiple lines of text boxes cannot be modified by the user.

III The code for the instance:

Instance 8 (8.asp)

<style type= "Text/css" >
body,td,th {
font-size:11pt;
Color: #000000;
line-height:1.5;
}
Body {
margin-top:50px;
margin-bottom:0px;
}
</style>
<body>
<form method= "Post" Name= "Form1" action= "8.asp" >
<table align= "center" bgcolor= "#d6d3ce" >
<tr>
<th bgcolor= "#0099cc" ><font color= "FFFFFF" > Multiline text field </font></th>
<tr>
&LT;TD height= "align=" "left" ><font color= "000000" > Please leave a message:</font></td>
</tr>
<tr>
&LT;TD height= "><textarea name=" content "cols=" rows= "4" > Gift Rose, hand left incense. </textarea></td>
</tr>
&LT;TR align= "center" >
&LT;TD height= "align=" "Center" ><input type= "Submit" value= "submitted" name= "Btnsubmit" >
<input type= "reset" value= "reset" name= "Btnreset" ></td>
</tr>
</table>
<p><p><center>**********************************************</center>
</form>
<%
Dim F1
F1=request.form ("content")
If f1<> "" Then
A= "<center><b> Your message is:"
b= "</b></center>"
Response.Write A & F1 & B
Else
Response.Write "<center><b> You haven't left a message yet. </b></center> "
End If
%>
</body>

2, use the option control in the form

i) Format:

With list box controls, you can have visitors select options from the list.

  <form name="表单的名称" method="get | post" action="URL">
    <SELECT name="字符串" size="整数" [MULTIPLE]>
     <OPTION [SELECTED] value="字符串">选项1</OPTION>
      <OPTION [SELECTED] value="字符串">选项1</OPTION>
      ......
    </SELECT>
  </form>

II) Properties:

The list box has the following properties (Table II)
property meaning
NAME

Specifies the name of the option control.

SIZE specified in the list The number of options that can be seen at a time.
multiple
SelectedIndex Returns or Set which option is selected.
LENGTH
style

Option has the following properties (Table III)

Property Meaning
TEXT

Specifies the text of the option.

VALUE Specifies the value of the option.
SELECTED Optional, plus this entry indicates that the item is preset, with only one <SELECT> tag.

III) Instance code:

Instance 9 (9.asp)

<style type= "Text/css" >
body,td,th {
font-size:11pt;
Color: #000000;
line-height:1.5;
}
Body {
margin-top:50px;
margin-bottom:0px;
}
</style>
<body>
<center><select size=2 style= "width:100px;" Name= "Select1" >
<option value= "Bei jings" > Beijing </option>
<option value= "Shang hai" > Shanghai </option>
<option value= "Tian Jin" > Tianjin </option>
<option value= "Chong Qing" > Chongqing </option>
</Select>
<p>
Number of options in the list box: <input type= "text" name= "Text1" size=3></p>
The value of the selected item is: <input type= "text" name= "Text2" size=10></p>
The text value for the selected item is: <input type= "text" name= "Text3" size=10></p></center>
<script for= "Select1" event= "OnClick" language= "VBScript" >
I=select1.selectedindex
Text1.value=select1.length
Text2.value=select1.options (i). Value
Text3.value=select1.options (i). Text
</Script>
</body>
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.