我的Blog我做主^_^

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

            BlogJava :: 首頁(yè) :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理 ::
            64 隨筆 :: 68 文章 :: 77 評(píng)論 :: 0 Trackbacks

          雖然經(jīng)常接觸HTML,不過(guò)有些標(biāo)簽以前卻從沒引起我的注意。但是其中幾個(gè)Tag的確比較有用,而且是符合W3C XHTML標(biāo)準(zhǔn)的。

          1. Label

          Label是用來(lái)標(biāo)記Input元素的提示的。例如:

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


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

          好處:點(diǎn)擊提示文字,就自動(dòng)Focus對(duì)應(yīng)的輸入元素。對(duì)于Radio,Checkbox這類點(diǎn)擊區(qū)域特別小的控件特別有用:
          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不匹配,點(diǎn)擊文字是沒有用的-->




          2. FieldSet & Legend

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

          <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) 評(píng)論(0)  編輯  收藏

          只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 桑日县| 滁州市| 金湖县| 桓台县| 毕节市| SHOW| 论坛| 镶黄旗| 昌乐县| 蒲江县| 科尔| 延寿县| 中超| 根河市| 九江县| 济南市| 河源市| 高碑店市| 峨边| 昌吉市| 马公市| 安阳市| 通辽市| 肃北| 左权县| 新源县| 双峰县| 松溪县| 饶阳县| 类乌齐县| 宁阳县| 庄浪县| 扶绥县| 河津市| 广丰县| 朔州市| 北票市| 龙江县| 西峡县| 壤塘县| 桃园县|