日期:2014-05-16 浏览次数:20792 次
<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
</head>
<body>
<p id="results"><b>Results:</b> </p>
<form>
<select name="single" style="margin-left:10px;padding:50px;">
<option>Single</option>
<option>Single2</option>
</select>
<select name="multiple" multiple="multiple" style="border:1px solid red;">
<option selected="selected">Multiple</option>
<option>Multiple2</option>
<option selected="selected">Multiple3</option>
</select><br/>
<input type="checkbox" name="check" value="check1"/> check1
<input type="checkbox" name="check" value="check2" checked="checked"/> check2
<input type="radio" name="radio" value="radio1" checked="checked" style="margin-top:10px;padding:20px;"/> radio1
<input type="radio" name="radio" value="radio2"/> radio2
</form>
<script type="text/javascript">
$(function(){
var fields = $("select, :radio").map(function(){
return $(this).attr('style');
}).get().join(',');
console.log(fields);
})
</script>
</body>
</html>