我的Blog我做主^_^

          走向一條通往JAVA的不歸路...

            BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理 ::
            64 隨筆 :: 68 文章 :: 77 評論 :: 0 Trackbacks

          雖然經常接觸HTML,不過有些標簽以前卻從沒引起我的注意。但是其中幾個Tag的確比較有用,而且是符合W3C XHTML標準的。

          1. Label

          Label是用來標記Input元素的提示的。例如:

          <label for="id_name">Name</label><br />
          <input type="text" name="name" id="id_name" size="20"/>


          Label的“For”屬性要和Input元素的ID相一致。

          好處:點擊提示文字,就自動Focus對應的輸入元素。對于Radio,Checkbox這類點擊區域特別小的控件特別有用:
          Color:<br />
          <input type="checkbox"? name="color" id="color_r" value="red"><label for="color_r">&nbsp;red</label><br>
          <input type="checkbox"? name="color" id="color_g" value="green"><label for="color_g">&nbsp;green</label><br>
          <input type="checkbox"? name="color" id="color_b" value="blue"><label for="color_x">&nbsp;blue</label><br><!--如果For和ID不匹配,點擊文字是沒有用的-->




          2. FieldSet & Legend

          FieldSet用來明確把一組Input控件歸成一組(相當于VB/VC里面的Group控件),而Legend則是組的標題(相當于Group控件的標題)。 例如:

          <fieldset style="width:20%">
          ? <legend>Person</legend>
          ? <label for="name">Name</label><input type="text" id="name" />
          ? <fieldset>
          ??? <legend>Gender</legend>
          ??? <input type="radio" name="gender" id="male" /><label for="male">Male</label><br>
          ??? <input type="radio" name="gender" id="female" /><label for="female">Female</label>
          ? </fieldset>
          </fieldset>

          Person
          Gender

          3. Optgroup

          用于Select里面的option的分組。例如:

          <select name="age">
          ? <optgroup label="baby">
          ??? <option>0-2</option>
          ??? <option>3-5</option>
          ? </optgroup>
          ? <optgroup label="kid">
          ??? <option>6-10</option>
          ??? <option>10-15</option>
          ? </optgroup>
          ? <optgroup label="adult">
          ??? <option>16-30</option>
          ??? <option>31-40</option>
          ??? <option>41-60</option>
          ? </optgroup>
          </select>

          http://blog.aspcool.com/zephyr/archive/2005/05/27/2385.html



          posted on 2007-02-05 14:31 java_蟈蟈 閱讀(226) 評論(0)  編輯  收藏

          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 左权县| 汝阳县| 黄石市| 博白县| 繁昌县| 都兰县| 竹山县| 平昌县| 陇南市| 香港 | 万宁市| 财经| 双鸭山市| 淅川县| 纳雍县| 竹溪县| 永新县| 甘谷县| 奉化市| 霍林郭勒市| 东阳市| 扶余县| 吉林市| 高雄市| 梓潼县| 万盛区| 开封县| 山东| 铅山县| 札达县| 上杭县| 昌平区| 桐柏县| 洪雅县| 满城县| 鄂托克前旗| 乌什县| 灌云县| 如东县| 高淳县| 虎林市|