<script type="text/javascript"> $(function () { $("#btnSubmit").click(function () { var txtName = $('#txtName').val(); var gender = $('#gender').is(':checked') ? '男' : '女'; var isMarry = $('#isMarry').is(':checked') ? '已婚' : '未婚'; $('#divTip').css('display', 'block').html(txtName + '<br/>' + gender + '<br/>' + isMarry); }) }) </script>
<div class="divFrame"> <div class="divTitle">请输入如下信息</div> <div class="divContent"> 姓名:<input id="txtName" type="text" class="txtcss"/><br /> 性别:<input id="gender" name="raGender" type="radio" value="男" />男 <input id="Radio1" name="raGender" type="radio" value="女" />女<br /> 婚否:<input id="isMarry" type="checkbox" /><br /> <div class="divBtn"><input id="btnSubmit" type="button" value="提交" class="btnCss" /></div> </div> </div> <div id="divTip" class="divTip"></div>