dragpanel.aspx

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

ASPX
118
字号
        // Validate that the panel has moved down from its original location
        function checkHasMovedVertical(position) {
            return function() {
                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) {
            return function() {
                testHarness.assertNotEqual(panel.offsetLeft, position, 'Left side of panel has not moved from position ' + position);
            };
        }

        // Validate that the panel has moved from the specified location
        function checkHasMoved(top, left) {
            return function() {
                checkHasMovedVertical(top);
                checkHasMovedHorizontal(left);
            };
        }

        // Fire an onmousedown event at point (x,y)
        function mouseDown(element, x, y) {
            return function() {
                var e = testHarness.getDocument().createEvent('MouseEvents');
                e.initMouseEvent('mousedown', true, false, window, 0, x, y, x, y, false, false, false, false, 0, null);
                element.dispatchEvent(e);
            };
        }

        // Fire an onmousemove event ending at point (x,y)
        function mouseMove(element, x, y) {
            return function() {
                var e = testHarness.getDocument().createEvent('MouseEvents');
                e.initMouseEvent('mousemove', true, false, window, 0, x, y, x, y, false, false, false, false, 0, null);
                element.dispatchEvent(e);
            };
        }

⌨️ 快捷键说明

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