1月22号学习jQuery(第80天的)

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EW" "http://www.w3.org/TR/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
   
    <head>
        <!--插入脚本 载入jquery-1.4.2.min.js文件 结束脚本-->
        <script language="javascript" type="text/javascript" src="jquery-1.4.2.min.js"></script>
        <!--插入脚本-->
        <script type="text/javascript">
            <!--创建对象-->
            $(function() {
<!--当点击id为btnSubmit的元素时-->
                $("#Byttonl").click(function() {
                    <!--定义 oTextValue 获得Textl的值-->
                    var oTextValue = $("#Textl").val();
                    <!--定义 oRdoValue 获得 radio 类型 名字为 rdoSex按钮 checked 选择器选取所有选中的复选框或单选按钮 的值-->
                    var oRdoValue = $('input:radio[name="rdoSex"]:checked').val();
                    <!--定义 oChkValue 获得Checkboxl is是 checked 选择器选取所有选中的复选框或单选按钮 的已婚 未婚-->
                    var oChkValue = $("#Checkboxl").is(":checked") ? "已婚" : "未婚";
                    <!--显示提示文本元素和内容-->
                    $("#divTip").html(oTextValue + oRdoValue + oChkValue);
                })
            })
            <!--结束脚本-->
        </script>
    </head>
   
    <body>
        <div class="divFrame">
            <div class="divTitle">清输入如下信息</div>
            <div class="divContent">姓名:
                <input id="Textl" type="text" class="txtCss" />
                <br />性别:
                <input id="Radiol" name="rdoSex" type="radio" value="男" />男
                <input id="Radio2" name="rdoSex" type="radio" value="女" />女
                <br />婚否:
                <input id="Checkboxl" type="checkbox" />
                <div class="divBtn">
                    <input id="Byttonl" type="button" value="提交" class="bthCss" />
                </div>
            </div>
        </div>
        <div id="divTip" class="divTip"></div>
    </body>

</html>

猜你喜欢

转载自xjwolaile.iteye.com/blog/1774085