//head部分 
<title></title>
    <style type="text/css">
        .red { color: red; }
        .large { font-size: xx-large; }
    </style>
    <script src="System.Web.Extensions/3.5.0.0/3.5.30729.1/MicrosoftAjax.js"></script>
    <script>
        $addCss = Sys.UI.DomElement.addCssClass;
        $removeCss = Sys.UI.DomElement.removeCssClass;
        $containsCss = Sys.UI.DomElement.containsCssClass;
        $toggleCss = Sys.UI.DomElement.toggleCssClass;
   
    </script>
//body 部分

  <form id="form1" runat="server">
     <input type="checkbox" id="inputElement" />
        <div id="someContainer">
            <input type="text" id="inputElement" />
        </div>
        <script language="javascript" type="text/javascript">
            document.write($get("inputElement").type + "<br />");
            document.write($get("inputElement", $get("someContainer")).type);
        </script>
       
        <hr />
        <div id="someText">Hello World</div>
        <input type="button" value="Add Red" onclick="$addCss($get('someText'), 'red')" />
        <input type="button" value="Remove Red" onclick="$removeCss($get('someText'), 'red')" />
        <input type="button" value="Toggle Large" onclick="$toggleCss($get('someText'), 'large')" />
        <input type="button" value="Contains Large" onclick="alert($containsCss($get('someText'), 'large'))" />
       
        <hr />
        <div id="anElement" style="background-color:Red; color: White; position: absolute; overflow: hidden">
            Hello World
        </div>
        <script language="javascript" type="text/javascript">
            function setRandomLocation() {
                var left = Math.floor(Math.random() * 100);
                var top = Math.floor(Math.random() * 100);
                Sys.UI.DomElement.setLocation($get("anElement"), left, top);
            }

            function setRandomSize() {
                $get("anElement").style.width = Math.floor(Math.random() * 100 + 50) + "px";
                $get("anElement").style.height = Math.floor(Math.random() * 100 + 50) + "px";
            }

            function showLocation() {
                var point = Sys.UI.DomElement.getLocation($get("anElement"));
                alert(String.format("X: {0}, Y: {1}", point.x, point.y));
            }

            function showBounds() {
                var bounds = Sys.UI.DomElement.getBounds($get("anElement"));
                alert(String.format("X: {0}, Y: {1}, Width: {2}, Height: {3}",
                    bounds.x, bounds.y, bounds.width, bounds.height));
            }
        </script>
        <input type="button" value="Set Location" onclick="setRandomLocation()" />
        <input type="button" value="Set Size" onclick="setRandomSize()" />
        <input type="button" value="Show Location" onclick="showLocation()" />
        <input type="button" value="Show Size" onclick="showBounds()" />
    </form>