<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" /> <title></title> <script src="js/mui.min.js"></script> <link href="css/mui.min.css" rel="stylesheet" /> <script type="text/javascript" charset="utf-8"> mui.init(); </script> </head> <body> <header class="mui-bar mui-bar-nav"> <!--顶部导航栏-带返回键--> <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a> <h1 class="mui-title">测试属性checkbox</h1> </header> <div class= "MUI-Content" > < div class = "MUI-INPUT-Row MUI MUI-Radio-left" > <-! MUI-box on the left represents the left -> < label > king </ label > < the INPUT name = "CheckBox1" value = "king" of the type = "Radio" class = "RDS" > <-! the checked = "the checked" is selected by default; class = "rds" easy access dom node -> </ div > < div class = "MUI-INPUT-Row MUI MUI-Radio-left" ><-! MUI-checkbox Radio -> < label> Moving bricks </ label > < INPUT name = "CheckBox1" value = "bricks transfer" type = "Radio" class = "RDS" > <-! Note radio button must be the same name, is a group represented by options -> </ div > < Button type = "Button" the onclick = "getVals ();" > Get value </ Button > </ div > < Script type = "text / JavaScript" > function getVals(){ var res =getRadioRes ( ' RDS ' ); IF (RES == null ) { mui.toast ( ' select ' ); return ; } mui.toast (RES); } function getRadioRes (className) { var rdsObj = document.getElementsByClassName (className ); / * get the value * / / * Alert (rdsObj.length); find a few test node * / var checkVal = null ; for(i = 0; i< rdsObj.length; i++){ if(rdsObj[i].checked){ checkVal = rdsObj[i].value; } } return checkVal; } </script> </body> </html>