用jQuery访问DOM对象

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <style type="text/css"> 
    .divFrame
    {
       width:260px; border:solid 1px #666; font-size:10pt;
        }
    .divTitle
    {
        background-color:#eee; padding:5px;
        }
     .divContent
     {
         padding:8px; font-size:9pt;
         }
     .divTip
     {
         width:244px; border:solid 1px #666; padding:8px; font-size:9pt; margin-top:5px; display:none;
         }
    .txtCss
    {
        border:solid 1px #ccc;
        }
     .divBtn
     {
        padding-top:5px;
         }
     .divBtn.btnCss
     {
         border:solid 1px #535353; width:60px;
         }
    </style>
    <script src="http://localhost:1679/jquery-1.9.1.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function () {
            $('#btnSubmit').click(function () {
                //获取文本框的值
                var oTxtValue = $('#Text1').val();
                //获取单选框按钮值
                var oRdoValue = $('#Radio1').is(':checked') ? "男" : "女";
                //获取复选框按钮值
                var oChkValue = $('#Checkbox1').is(':checked') ? "已婚" : "未婚";
                //显示提示文本元素和内容
                $('#divTip').css('display', 'block').html(oTxtValue + '</br>' + oRdoValue + '</br>'+ oChkValue);
            })
        })
    </script>
</head>
<body>
<div class="divFrame">
<div class="divContent">
姓名:<input id="Text1" type="text" class="txtCss" /><br />
性别:<input type="radio" id="Radio1" name="rdoSex" value="男" />男
<input id="Radio2" name="rdoSex" type="radio" value="女" />女<br />
婚否:<input id="Checkbox1" type="checkbox" />
<div class="divBtn"><input id="btnSubmit" type="button" value="提交" class="btnCss" /></div>
</div>
</div>
<div id="divTip" class="divTip"></div>
</body>
</html>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值