亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

jQuery獲取(選中)單選,復(fù)選框,下拉框中的值

 更新時間:2014年02月21日 09:24:16   作者:  
本篇文章主要是對jQuery獲取(選中)單選,復(fù)選框,下拉框中的值的實現(xiàn)方法進行了介紹,需要的朋友可以過來參考下,希望對大家有所幫助

實例如下:

復(fù)制代碼 代碼如下:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>MyHtml.html</title>

<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">

<!--<link rel="stylesheet" type="text/css" href="./styles.css">-->
<script type="text/javascript" src="jquery-1.3.min.js"></script>
<script type="text/javascript">
function aa(){
// 獲取單選按鈕的值
var a = $("input[name='sex'][checked]").val();
alert(a);
}
function bb(){
// 若選中返回true,否則返回false
var c = $("#a").attr("checked");
alert(c);

// 獲取單個復(fù)選框的值
var d = $("input[name='checkName'][checked]").val();
alert(d);

// 獲取多個復(fù)選框的值
$("input[name='checkName'][checked]").each(function(){
if(this.checked)
alert($(this).val());
});
}

function checkWeek(){
//var $param = {};
$("#mPrefType").each(function(){
//    var key = $(this).attr("name");
//    if(!$param[key])
//        $param[key] = [];
// 獲得value值
var value = $("##mPrefType option:selected").val();
alert(value);
// 獲得需要的值
var name = $("##mPrefType option:selected").text();
alert(name);
});
}
</script>
</head>

<body>
Number:<input type = "text" value ="" name ="num1"/><br>
Number:<input type = "text" value ="" name = "num2"/><br>
<input type = "radio" value = "a"  name = "ss" />a
<input type = "radio" value = "b"  name = "ss" />b
<input type = "radio" value = "c"  name = "ss"/>c
<input type = "radio" value = "d"  name = "ss" >d<br>
<input type = "submit"  value = "提交"/> <br>
<hr>
<input type="radio" value="男" name="sex" id="1" onclick="aa()"/>男
<input type="radio" value="女" name="sex" id="0" onclick="aa()"/>女<br>
<input type="button" value="您選擇的性別" onclick="aa()"/><br>
<hr>
<input type="checkbox" name="checkName" value="aa" id="a"/>aa
<input type="checkbox" name="checkName" value="bb" id="b"/>bb
<input type="checkbox" name="checkName" value="cc"/>cc
<input type="checkbox" name="checkName" value="dd"/>dd<br>
<input type="button" value="您選擇的值是" onclick="bb()"/>
<hr>
<ul>
<li>請選澤</li>
<li>
<select id="mPrefType" name="mPrefType" class="inputS" onchange="checkWeek()">
<option value=0>請選擇:</option>
<option value=1>星期一</option>
<option value=2>星期二</option>
<option value=3>星期三</option>
<option value=4>星期四</option>
<option value=5>星期五</option>
<option value=6>星期六</option>
<option value=7>星期日</option>
</select>
</li>
</ul>
</body>
</html>

相關(guān)文章

  • JQuery異步加載PartialView的方法

    JQuery異步加載PartialView的方法

    這篇文章主要介紹了JQuery異步加載PartialView的方法,涉及jQuery與asp.net交互及異步操作相關(guān)技巧,具有一定參考借鑒價值,需要的朋友可以參考下
    2016-06-06
  • ajax異步請求詳解

    ajax異步請求詳解

    做前端開發(fā)的朋友對于ajax異步更新一定印象深刻,本文主要介紹了關(guān)于ajax異步請求的那點事,具有一定的參考價值,下面跟著小編一起來看下吧
    2017-01-01
  • 基于jquery的修改當前TAB顯示標題的代碼

    基于jquery的修改當前TAB顯示標題的代碼

    在當前tab選項卡中單擊鏈接后,新內(nèi)容在當前選項卡中顯示,但標題內(nèi)容還是上一頁標題要改為新的標題。
    2010-12-12
  • jquery keypress,keyup,onpropertychange鍵盤事件

    jquery keypress,keyup,onpropertychange鍵盤事件

    項目所需,在試圖用js實現(xiàn)這樣的功能:文本框失去焦點時,判斷輸入字符串的長度,以驗證是否超出范圍,超出范圍則自動截取。
    2010-06-06
  • jQuery中 delegate使用的問題

    jQuery中 delegate使用的問題

    本文主要給大家介紹的是在jQuery中使用delegate的時候遇到的幾個小小的坑,主要是習(xí)慣了使用bind,live,一時改不過來的問題,這里記錄下來推薦給大家。
    2015-07-07
  • jQuery鏈使用指南

    jQuery鏈使用指南

    這篇文章主要介紹了jQuery鏈使用方法,以及用哪些方法尅控制jQuery鏈,非常的詳細,需要的朋友可以參考下
    2015-01-01
  • easyui取消表單實時驗證,提交時統(tǒng)一驗證的簡單實例

    easyui取消表單實時驗證,提交時統(tǒng)一驗證的簡單實例

    下面小編就為大家?guī)硪黄猠asyui取消表單實時驗證,提交時統(tǒng)一驗證的簡單實例。小編覺得挺不錯的,現(xiàn)在就分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2016-11-11
  • jquery檢測input checked 控件是否被選中的方法

    jquery檢測input checked 控件是否被選中的方法

    這篇文章主要介紹了jquery檢測input checked 控件是否被選中的方法,需要的朋友可以參考下
    2014-03-03
  • jquery中each方法示例和常用選擇器

    jquery中each方法示例和常用選擇器

    這篇文章主要介紹了jquery中each方法使用及常用選擇器都有哪些,需要的朋友,可以參考下
    2014-07-07
  • jquery遍歷標簽中自定義的屬性方法

    jquery遍歷標簽中自定義的屬性方法

    下面小編就為大家?guī)硪黄猨query遍歷標簽中自定義的屬性方法。小編覺得挺不錯的,現(xiàn)在就分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2016-09-09

最新評論