ready与onload区别一
<!DOCTYPE html>
<html>
<head>
<title>ready与onload区别一</title>
<meta charset="utf-8"/>
<script src="scripts/jquery-1.11.3.js"></script>
</head>
<script>
/*
window.onload = function(){
var username = document.getElementById("username");
console.log(username.value);
}*/
$().ready(function(){
console.log($("#username").val());
})
</script>
<body>
<input type="text" id="username" value="请输入你的用户名">
<input type="text" id="password" value="请输入你的密码">
</body>
<script>
/*
window.onload = function(){
var pwd = document.getElementById("password");
console.log(pwd.value);
}*/
$().ready(function(){
console.log($("#password").val());
})
</script>
</html>
紫云(深圳)软件有限公司
云数据时代引领者
微信:Chizcloud
微博:http://weibo.com/Chizcloud