国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > JavaScript > 正文

jquery實現選中單選按鈕下拉伸縮效果

2019-11-20 11:54:38
字體:
來源:轉載
供稿:網友

本文實例講述了jquery實現選中單選按鈕下拉伸縮效果的方法。分享給大家供大家參考。具體如下:

這是一個使用jQuery插件實現的伸縮效果,在網頁上,單擊單選按鈕,也就是Radio元素后,所屬的對應內容向下拉出,伸展開來,平時是不顯示的,可用在發票打印快遞單查詢等場合。

運行效果如下圖所示:

具體代碼如下:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>下拉伸縮效果</title><script type="text/javascript" src="jquery-1.6.2.min.js"></script><style type="text/css">body,ul,li,h1,h2,h3{margin:0px; padding:0;}li{list-style:none;}.m-collapsed, .m-expanded{margin-bottom: 20px;}.m-collapsed div{display: none;}.m-collapsed h3{background-color: #F1F1F1; color: #FF3399; cursor: pointer; font-size: 16px; height: 30px; line-height: 30px; padding-left: 20px;}.m-collapsed h3 span{color: #333333; font-size: 14px; font-weight: normal; padding-left: 20px;}.m-expanded{border: 1px solid #F691C3; padding: 10px 20px 20px;}.m-expanded h3{color: #FF3399; cursor: pointer; font-size: 16px; margin-bottom: 20px;}.m-expanded h3 span{display: none;}</style><script type="text/javascript">$(document).ready(function(){   var $tree_li = $("ul.tree li > h3")   $tree_li.click(function(){       var index = $tree_li.index(this);    var $div = $("ul.tree li h3").eq(index).next("div");      if($div.is(":visible")){      $(this).parent().attr("class","m-collapsed");      $div.hide();      $(this).find("input[type='checkbox']").removeAttr("checked","checked");    }else{      $(this).parent().attr("class","m-expanded");      $div.show();      $(this).find("input[type='checkbox']").attr("checked","checked");    }  return false;   }) })</script></head><body><h1>下拉伸縮效果帶復選框</h1><div ><ul class="tree"> <li class="m-collapsed">  <h3><input name="" type="checkbox" value="" />  索要發票</h3>  <div class="mt20">   <div style="height:116px" class="pop-red-content noborder">   <div class="mt5 receipt-option"> <span>發票抬頭:</span> <span>    <input type="radio" checked="checked" value="P" name="radio-title" id="title-p">    <label class="ml5" for="title-p">個人</label>    </span> <span class="ml20">    <input type="radio" value="C" name="radio-title" id="title-g">    <label class="ml5" for="title-g">單位</label>    </span> </div>   <div class="mt10 gname clearfix">    <div id="div1">    <label class="fl" for="g-name">單位名稱:</label>    <input type="text" maxlength="50" name="g-name" id="g-name" style="width:200px; height:21px; line-height:21px;">    <span class="ml5 lower "></span> </div>   </div>   <div class="mt10 receipt-option clearfix">    <label class="fl" for="receipt-cata">發票內容:</label>    <select id="drpInvoiceType" name="drpInvoiceType">    <option value="">明細</option>    <option value="FS">服裝服飾</option>    <option value="BG">辦公用品</option>    </select>   </div>   <div class="ml60 mt10">    <input type="submit" value="提交">   </div>   </div>  </div>  </li> </ul></div></body></html>

希望本文所述對大家的jquery程序設計有所幫助。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 积石山| 禹城市| 利川市| 敦煌市| 三江| 万源市| 诸暨市| 通榆县| 浙江省| 三原县| 武强县| 涞水县| 镇宁| 白沙| 德格县| 思茅市| 柘荣县| 云和县| 望都县| 岳阳市| 岳阳县| 延边| 新宁县| 陇川县| 牡丹江市| 汝州市| 新丰县| 呈贡县| 旅游| 宁化县| 普兰店市| 宣恩县| 根河市| 河东区| 库尔勒市| 新邵县| 新龙县| 平湖市| 临武县| 青神县| 都江堰市|