<!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>
    <script src="Scripts/jquery-1.4.1.js" type="text/javascript"></script>
    <script type="text/javascript">
        function alert1() {//body的onload在加载完成后执行alert1()
            var content = document.getElementById("div1").innerHTML;
            alert(content);
        }
        //和上面效果一样的JQuery
        $(function () { alert($("#div1").html()); });//取得div中的值
        $(function () { $("#div1").css("background", "red") }); //给层属性赋值
        $(function () { alert($("#div1").css("background")) }); //取得属性的值
        $(function () { $("#text1").val(new Date()) }); //给文本框赋值
        $(function () { alert($("#text1").val()) });//取得文本框的值
    </script>
    
</head>
<body onload="alert1()">
<div id="div1">Hello</div>
<input id="text1" type="text" />
</body>
</html>