js 獲取input點(diǎn)選按鈕的值的方法
更新時間:2014年04月14日 15:17:28 作者:
這篇文章主要介紹了js 如何獲取input點(diǎn)選按鈕的值,需要的朋友可以參考下
html:
<input type= "radio" name="isEnd" value='1'>是
<input type= "radio" name="isEnd" value='0' checked=checked>否
<script type="text/javascript">
var isEnd;
function getRadioVal(){
var temp = document.getElementsByName("isEnd");
for(var i=0;i<temp.length;i++)
{
if(temp[i].checked){
isEnd = temp[i].value;
return isEnd;
break;
}
}
}
</script>
復(fù)制代碼 代碼如下:
<input type= "radio" name="isEnd" value='1'>是
<input type= "radio" name="isEnd" value='0' checked=checked>否
<script type="text/javascript">
var isEnd;
function getRadioVal(){
var temp = document.getElementsByName("isEnd");
for(var i=0;i<temp.length;i++)
{
if(temp[i].checked){
isEnd = temp[i].value;
return isEnd;
break;
}
}
}
</script>
您可能感興趣的文章:
- JS驗(yàn)證控制輸入中英文字節(jié)長度(input、textarea等)具體實(shí)例
- js限制input標(biāo)簽中只能輸入中文
- JS獲取及設(shè)置TextArea或input文本框選擇文本位置的方法
- js實(shí)現(xiàn)點(diǎn)擊添加一個input節(jié)點(diǎn)
- js控制input框只讀實(shí)現(xiàn)示例
- js實(shí)現(xiàn)Form欄顯示全格式時間時鐘效果代碼
- js實(shí)時獲取并顯示當(dāng)前時間的方法
- js實(shí)現(xiàn)時間顯示幾天前、幾小時前或者幾分鐘前的方法集錦
- js實(shí)現(xiàn)input框文字動態(tài)變換顯示效果
相關(guān)文章
JS Math對象與Math方法實(shí)例小結(jié)
這篇文章主要介紹了JS Math對象與Math方法,結(jié)合實(shí)例形式總結(jié)分析了javascript中math對象常用屬性與方法相關(guān)使用技巧,需要的朋友可以參考下2019-07-07
解讀CocosCreator源碼之引擎啟動與主循環(huán)
這篇文章主要介紹了CocosCreator源碼解讀之引擎啟動與主循環(huán),對CocosCreator感興趣的同學(xué),可以研究參考一下2021-04-04
跨瀏覽器的 mouseenter mouseleave 以及 compareDocumentPosition的使用說明
昨天去 大牛 司徒正美 的blog 看博文 突然看到 關(guān)于 onmouseenter 和onmouseleave 兩個ie專有事件..2010-05-05
javascript之textarea打字機(jī)效果提示代碼推薦
非常不錯的提示輸入內(nèi)容,動態(tài)的提示,給人親切感2008-09-09
JavaScript實(shí)現(xiàn)獲取dom中class的方法
這篇文章主要介紹了JavaScript實(shí)現(xiàn)獲取dom中class的方法,涉及javascript操作dom節(jié)點(diǎn)的使用技巧,需要的朋友可以參考下2015-02-02

