<strong>1、JavaScript访问DOM对象方法</strong>: <br>var oTxtValue=document.getElementById("Text1").value; <br><strong>2、JQuery访问DOM对象方法</strong>: <br>var oTxtValue=$("#Text1").val(); <br>通过JQuery库中的方法访问或控制页面中的元素,比使用JavaScript代码要简洁得多,而且兼容各浏览器。 <br>示例代码: <br><div class="codetitle"> <span><a style="CURSOR: pointer" data="74787" class="copybut" id="copybut74787" onclick="doCopy('code74787')"><u>复制代码</u></a></span> 代码如下:</div> <div class="codebody" id="code74787"> <br> <br> <br> <br><title> 控制DOM对象 </title> <br><meta name="Generator" content="EditPlus"> <br><meta name="Author" content=""> <br><meta name="Keywords" content=""> <br><meta name="Description" content=""> <br><style type="text/css"> <BR>.divFrame{width:260px;border:solid 1px #666;font-size:10pt} <BR>.divTitle{background-color:#eee;padding:5px} <BR>.divContent{padding:8px;font-size:9pt} <BR>.divTip{width:244px;border:solid 1px #666;padding:8px;font-size:9pt;margin-top:5px;display:none} <BR>.txtSss{border:solid 1px #ccc} <BR>.divBtn{padding-top:5px} <BR>.divBtn.btnCss{border:solid 1px #535353;width:60px} <BR></style> <br><script language="javascript" type="text/javascript" src="jquery-1.8.3.min.js"> <BR></script> <br><script type="text/javascript"> <BR>$(function(){ <BR>$("#btnSumbit").click(function(){ <BR>var oTxtValue=$("#Text1").val(); <BR>var oRdoValue=$("#Radio1").is(":checked")?"男":"女"; <BR>var oChkValue=$("#Checkbox1").is(":checked")?"已婚":"未婚"; <BR>$("#divTip").css("display","block").html(oTxtValue+"<br>"+oRdoValue+"<br>"+oChkValue); <BR>}) <BR>}) <BR></script> <br> <br> <br><div class="divFrame"> <br><div class="divTitle">请输入如下信息</div> <br><div class="divContent"> <br>姓名:<input id="Text1" type="text" class="txtCss"><br> <br>性别:<input id="Radio1" name="rdoSex" type="radio" value="男">男 <br><input id="Radio2" name="rdoSex" type="radio" value="女">女<br> <br>婚否:<input id="Checkbox1" type="checkbox"> <br><div class="divBtn"> <input id="btnSumbit" type="button" value="提交" class="btnCss">onclick="btnClick();"> <br> </div> <br> </div> <br> </div> <br><div id="divTip" class="divTip"></div> <br> <br> <br> </div> <br><strong>效果图</strong>: <br><img style="max-width:90%" src="http://files.jb51.net/file_images/article/201301/201317105503762.jpg" style="max-width:90%" alt="jquery入门—访问DOM对象方法_jquery" >