<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<input type="text" value="aaa" id="ipu1"/>
<script src="../libs/jquery-1.11.0.min.js"></script>
<script>
//Dom对像
var values = document.getElementById("ipu1").value;
//获得jquery对像
var $va = $("#ipu1");
alert($va.val());
//alert(values);
</script>
</body>
</html>
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<script src="../libs/jquery-1.11.0.min.js"></script>
<script>
/*//dom对像
var ipu1 = document.getElementById("ipu1");
//Dom转成jquery对像
var $ipu1 = $(ipu1);
console.log($ipu1.val());*/
//得到jquery对像
var $ipu1 = $("#ipu1");
//转成Dom对像 jquery对象.get(index)
var ipu1 = $ipu1.get(0);
alert(ipu1.value);
</script>
</head>
<body>
<input type="text" value="aaa" id="ipu1"/>
</body>
</html>
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
<html>
<head>
<meta charset="UTF-8">
<title></title>
<script src="../libs/jquery-1.11.0.min.js"></script>
<script>
/*方式1:
$(function(){...})
方式2:
$(document).ready(function(){});*/
//方式1:
/*$(function(){
//得到jquery对像
var $ipu1 = $("#ipu1");
//转成Dom对像 jquery对象.get(index)
var ipu1 = $ipu1.get(0);
alert(ipu1.value);
});*/
/*//方式2:
$(document).ready(function(){
//得到jquery对像
var $ipu1 = $("#ipu1");
//转成Dom对像 jquery对象.get(index)
var ipu1 = $ipu1.get(0);
alert(ipu1.value);
});*/
//js里的页面加载完成,只能写一次,
/*window.onload = function(){
alert("aaaa");
};
window.onload = function(){
alert("bbb");
};*/
$(function(){
alert("aaaa");
})
$(function(){
alert("bbb");
})
</script>
</head>
<body>
<input type="text" value="aaa" id="ipu1"/>
</body>
</html>