alwaysvisiblecontrol.aspx

来自「AJAX 应用 实现页面的无刷新」· ASPX 代码 · 共 138 行 · 第 1/3 页

ASPX
138
字号
        var initialLeft = 40;

        // Validate the initial location of the panel
        function checkInitialPosition() {
            testHarness.assertEqual(panel.offsetTop, initialTop, "Top of panel is at position " + panel.offsetTop + " instead of initial position " + initialTop);
            testHarness.assertEqual(panel.offsetLeft, initialLeft, "Left side of panel is at position " + panel.offsetLeft + " instead of initial position " + initialLeft);
        }

        // Validate that the panel has moved down from its original location
        function checkHasMovedVertical(position) {
                testHarness.assertNotEqual(panel.offsetTop, position, "Top of panel has not moved from position " + position);
        }

        // Validate that the panel has moved right from its original location
        function checkHasMovedHorizontal(position) {
                testHarness.assertNotEqual(panel.offsetLeft, position, "Left side of panel has not moved from position " + position);
        }
        
        // Scroll the page so that the element is visible
        function scrollIntoView(element) {
            return function() { element.scrollIntoView(); }
        }
        
        // Make sure the browser supports animation for this test (i.e. whether or not the browser
        // supports CSS position: fixed)
        function requiresAnimation() {
            
            if (Sys.Browser.agent == Sys.Browser.InternetExplorer && Sys.Browser.version < 7.0) {
                return;
            }
            
            testHarness.cancel('This test can only be run on a browser that does not support CSS "position: fixed" (like IE6)');
        }

        // Register the AlwaysVisibleControl test cases
        function registerTests(harness) {
            testHarness = harness;

             // Get the controls on the page
            panel = testHarness.getElement("ctl00_ContentPlaceHolder1_content");
            btn = testHarness.getElement("ctl00_ContentPlaceHolder1_Button1");
            begin = testHarness.getElement("begin");
            end = testHarness.getElement("end");
            right = testHarness.getElement("right");
            
            // Get the ASP.NET AJAX objects on the page

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?