JBOSS 點滴

          豐豐的博客

          javascript insertAdjacentHTML

          下面的例子使用 INPUT type=checkbox 元素創建了兩個帶有解釋文本的復選框。onclick 事件將調用兩個腳本函數。第一個復選框默認選中。

          This example uses the INPUT type=checkbox element to create two check boxes with explanatory text. The onclick events call two script functions. The first check box is checked.

          <INPUT TYPE=checkbox CHECKED ID=chk1 onclick="choosebox1()">Uncheck 
              this check box for some free advice.
          <P><INPUT TYPE=checkbox ID=chk2 onclick="choosebox2()">Or check 
              this check box for a message from our sponsors.
          <P ID=SampText>

          下面的例子就是用戶單擊復選框時調用的腳本。

          This example implements the script when the user clicks either check box.

          <SCRIPT>
          function choosebox1(){
            alert("Never play leapfrog with a unicorn!")
          }
          function choosebox2(){
           SampText.insertAdjacentHTML("AfterBegin","Buy WonderWidgets! ");當點擊復先框時,在復選框后自動增加語句Buy WonderWidgets
          }
          </SCRIPT>

          posted on 2009-11-04 16:04 半導體 閱讀(219) 評論(0)  編輯  收藏 所屬分類: javascript

          主站蜘蛛池模板: 平顺县| 兰溪市| 如皋市| 贵德县| 佛教| 周口市| 颍上县| 商城县| 青河县| 伊春市| 郑州市| 拉孜县| 白银市| 清苑县| 乌兰察布市| 上林县| 尤溪县| 陆丰市| 金坛市| 荆门市| 安国市| 长宁县| 仪陇县| 剑川县| 开封县| 泰和县| 镇宁| 綦江县| 莱西市| 松阳县| 柳河县| 鹤壁市| 乾安县| 兴国县| 黑水县| 越西县| 疏附县| 启东市| 长寿区| 白水县| 宁陕县|