Asp.net源码专业站
首页->博客空间->WO@BIZ第一季1.2版源码>>admin/Js/Wo_Modal.js>>源码在线查看
温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:WO@BIZ第一季1.2版源码
当前文件:文件类型 WOBIZ/admin/Js/Wo_Modal.js[23K,2009-6-12 11:58:35]打开代码结构图
普通视图
		            
1 2Wo_Modal = new Object(); 3Wo_Modal._variableName = 'Wo_Modal'; 4Wo_Modal.LoadingHtmlUrl = null; 5Wo_Modal.WindowCssClasses = new Array(); 6Wo_Modal.WindowTitleCssClasses = new Array(); 7Wo_Modal.WindowCloseCssClasses = new Array(); 8Wo_Modal.WindowContentCssClasses = new Array(); 9Wo_Modal.WindowMaskCssClasses = new Array(); 10Wo_Modal.WindowFooterCssClasses = new Array(); 11Wo_Modal.WindowResizeCssClasses = new Array(); 12Wo_Modal.ZIndex = 100; 13Wo_Modal._isShown = false; 14Wo_Modal._initialized = false; 15Wo_Modal._modal = null; 16Wo_Modal._modalTitle = null; 17Wo_Modal._modalClose = null; 18Wo_Modal._modalAnimationMask = null; 19Wo_Modal._modalMask = null; 20Wo_Modal._modalIframe = null; 21Wo_Modal._modalResize = null; 22Wo_Modal._modalFooter = null; 23Wo_Modal._modalContent = null; 24Wo_Modal._animationHandle = null; 25Wo_Modal._isOpening = false; 26Wo_Modal._hiddenSelects = null; 27Wo_Modal._checkForScrollResizeHandle = null; 28Wo_Modal._lastModalInfo = null; 29Wo_Modal._lastWindowInfo = null; 30Wo_Modal._isDragging = false; 31Wo_Modal._moveModalInfo = null; 32Wo_Modal._resizeModalInfo = null; 33Wo_Modal._isResizing = false; 34 35Wo_Modal.Configure = function(loadingHtmlUrl, windowCssClasses, windowTitleCssClasses, windowCloseCssClasses, windowContentCssClasses, windowFooterCssClasses, windowResizeCssClasses, windowMaskCssClasses, zIndex) 36{ 37 this.LoadingHtmlUrl = loadingHtmlUrl; 38 this.WindowCssClasses = windowCssClasses; 39 this.WindowTitleCssClasses = windowTitleCssClasses; 40 this.WindowCloseCssClasses = windowCloseCssClasses; 41 this.WindowContentCssClasses = windowContentCssClasses; 42 this.WindowMaskCssClasses = windowMaskCssClasses; 43 this.WindowFooterCssClasses = windowFooterCssClasses; 44 this.WindowResizeCssClasses = windowResizeCssClasses; 45 this.ZIndex = zIndex; 46} 47 48Wo_Modal.IsShown = function() 49{ 50 return this._isShown; 51} 52 53Wo_Modal._getWindowInfo = function() 54{ 55 var scrollX = 0, scrollY = 0, width = 0, height = 0, contentWidth = 0, contentHeight = 0; 56 57 if (typeof(window.pageXOffset) == 'number') 58 { 59 //Netscape compliant 60 scrollX = window.pageXOffset; 61 scrollY = window.pageYOffset; 62 } 63 else if (document.body && (document.body.scrollLeft || document.body.scrollTop)) 64 { 65 //DOM compliant 66 scrollX = document.body.scrollLeft; 67 scrollY = document.body.scrollTop; 68 } 69 else if (document.documentElement && (document.documentElement.scrollLeft || document.documentElement.scrollTop)) 70 { 71 //IE6 standards compliant mode 72 scrollX = document.documentElement.scrollLeft; 73 scrollY = document.documentElement.scrollTop; 74 } 75 76 if (typeof(window.innerWidth) == 'number') 77 { 78 //Non-IE 79 width = window.innerWidth; 80 height = window.innerHeight; 81 } 82 else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) 83 { 84 //IE 6+ in 'standards compliant mode' 85 width = document.documentElement.clientWidth; 86 height = document.documentElement.clientHeight; 87 } 88 else if (document.body && (document.body.clientWidth || document.body.clientHeight)) 89 { 90 //IE 4 compatible 91 width = document.body.clientWidth; 92 height = document.body.clientHeight; 93 } 94 95 if (document.documentElement && (document.documentElement.scrollHeight || document.documentElement.offsetHeight)) 96 { 97 if (document.documentElement.scrollHeight > document.documentElement.offsetHeight) 98 { 99 contentWidth = document.documentElement.scrollWidth; 100 contentHeight = document.documentElement.scrollHeight; 101 } 102 else 103 { 104 contentWidth = document.documentElement.offsetWidth; 105 contentHeight = document.documentElement.offsetHeight; 106 } 107 } 108 else if (document.body && (document.body.scrollHeight || document.body.offsetHeight)) 109 { 110 if (document.body.scrollHeight > document.body.offsetHeight) 111 { 112 contentWidth = document.body.scrollWidth; 113 contentHeight = document.body.scrollHeight; 114 } 115 else 116 { 117 contentWidth = document.body.offsetWidth; 118 contentHeight = document.body.offsetHeight; 119 } 120 } 121 else 122 { 123 contentWidth = width; 124 contentHeight = height; 125 } 126 127 if (height > contentHeight) 128 height = contentHeight; 129 130 if (width > contentWidth) 131 width = contentWidth; 132 133 var rect = new Object(); 134 rect.ScrollX = scrollX; 135 rect.ScrollY = scrollY; 136 rect.Width = width; 137 rect.Height = height; 138 rect.ContentWidth = contentWidth; 139 rect.ContentHeight = contentHeight; 140 141 return rect; 142} 143 144Wo_Modal._getCurrentStyleValue = function(element, styleRule, jsStyleRule) 145{ 146 var value = 0; 147 148 if(document.defaultView && document.defaultView.getComputedStyle) 149 value = parseInt(document.defaultView.getComputedStyle(element, "").getPropertyValue(styleRule), 0); 150 else if(element.currentStyle) 151 value = parseInt(element.currentStyle[jsStyleRule], 0); 152 153 if (!isNaN(value)) 154 return value; 155 else 156 return 0; 157} 158 159Wo_Modal._calculateStyleOffset = function(element) 160{ 161 var result = new Object(); 162 163 result.Height = this._getCurrentStyleValue(element, 'border-top-width', 'borderTopWidth') + 164 this._getCurrentStyleValue(element, 'border-bottom-width', 'borderBottomWidth') + 165 this._getCurrentStyleValue(element, 'padding-top', 'paddingTop') + 166 this._getCurrentStyleValue(element, 'padding-bottom', 'paddingBottom'); 167 168 result.Width = this._getCurrentStyleValue(element, 'border-left-width', 'borderLeftWidth') + 169 this._getCurrentStyleValue(element, 'border-right-width', 'borderRightWidth') + 170 this._getCurrentStyleValue(element, 'padding-left', 'paddingLeft') + 171 this._getCurrentStyleValue(element, 'padding-right', 'paddingRight'); 172 173 return result; 174} 175 176Wo_Modal.Open = function (url, width, height, onCloseFunction, x, y, ignoreCloseAndAnimation) 177{ 178 if (!ignoreCloseAndAnimation && this._isShown) 179 this.Close(); 180 else if (this._hiddenSelects) 181 { 182 for (var i = 0; i < this._hiddenSelects.length; i++) 183 { 184 if (this._hiddenSelects[i].Element.style.visibility == 'hidden') 185 this._hiddenSelects[i].Element.style.visibility = this._hiddenSelects[i].Visibility; 186 } 187 188 this._hiddenSelects = null; 189 } 190 191 if (!this._initialized) 192 this._initialize(); 193 194 try 195 { 196 this._modalTitle.childNodes[1].innerHTML = this._modalIframe.contentWindow.document.title; 197 } 198 catch (err) 199 { 200 } 201 202 if (!ignoreCloseAndAnimation) 203 this._modalIframe.src = url; 204 205 try 206 { 207 this._modalIframe.contentWindow.opener = window; 208 } 209 catch (err) 210 { 211 } 212 213 this._modalAnimationMask.style.display = 'none'; 214 this._modalMask.style.display = 'none'; 215 216 // retrieve the window info 217 this._lastWindowInfo = this._getWindowInfo(); 218 219 this._modalAnimationMask.style.display = 'block'; 220 221 // width/height of panel 222 if (width > this._lastWindowInfo.Width) 223 width = this._lastWindowInfo.Width; 224 225 this._modalAnimationMask.style.position = 'absolute'; 226 this._modalAnimationMask.style.zIndex = this.ZIndex; 227 this._modalAnimationMask.style.display = 'block'; 228 this._modalAnimationMask.style.visibility = 'hidden'; 229 this._modalAnimationMask.style.overflow = 'hidden'; 230 231 this._modalAnimationMask.style.width = width + 'px'; 232 this._modalContent.style.width = width + 'px'; 233 234 this._modal.style.position = 'absolute'; 235 this._modal.style.display = 'block'; 236 this._modal.style.visibility = 'hidden'; 237 this._modal.style.left = '0px'; 238 this._modal.style.top = '0px'; 239 240 this._modalMask.style.position = 'absolute'; 241 this._modalMask.style.display = 'block'; 242 this._modalMask.style.zIndex = this.ZIndex; 243 this._modalMask.style.visibility = 'visible'; 244 245 var modalContentOffset = this._calculateStyleOffset(this._modalContent); 246 247 var offset = (this._modal.offsetHeight - this._modalContent.offsetHeight) - modalContentOffset.Height; 248 if (height + offset > this._lastWindowInfo.Height) 249 height = this._lastWindowInfo.Height - offset; 250 251 if (width < this._modalResize.offsetWidth * 2) 252 width = this._modalResize.offsetWidth * 2; 253 254 if (width < this._modalClose.offsetWidth * 2) 255 width = this._modalClose.offsetWidth * 2; 256 257 if (height < this._modalTitle.offsetHeight + this._modalFooter.offsetHeight) 258 height = this._modalTitle.offsetHeight + this._modalFooter.offsetHeight; 259 260 this._modalIframe.style.height = height + 'px'; 261 this._modalContent.style.height = height + 'px'; 262 this._modalContent.style.width = (width - (this._modal.offsetWidth - this._modalContent.offsetWidth) - modalContentOffset.Width) + 'px'; 263 this._modalAnimationMask.style.width = width + 'px'; 264 this._modalAnimationMask.style.height = this._modal.offsetHeight + 'px'; 265 266 this._modalMask.style.left = '0px'; 267 this._modalMask.style.top = '0px'; 268 this._modalMask.style.width = this._lastWindowInfo.ContentWidth + 'px'; 269 this._modalMask.style.height = this._lastWindowInfo.ContentHeight + 'px'; 270 271 this._lastWindowInfo = this._getWindowInfo(); 272 273 var panelWidth = this._modal.offsetWidth; 274 var panelHeight = this._modal.offsetHeight; 275 var animatePropertyName, animateTargetValue, animateNextValue; 276 277 if (typeof(x) == 'undefined' || isNaN(parseInt(x, 10))) 278 x = ((this._lastWindowInfo.Width - panelWidth) / 2) + this._lastWindowInfo.ScrollX; 279 280 if (x + panelWidth > this._lastWindowInfo.Width + this._lastWindowInfo.ScrollX) 281 x = this._lastWindowInfo.Width + this._lastWindowInfo.ScrollX - panelWidth; 282 283 if (x < this._lastWindowInfo.ScrollX) 284 x = this._lastWindowInfo.ScrollX; 285 286 if (typeof(y) == 'undefined' || isNaN(parseInt(y, 10))) 287 y = ((this._lastWindowInfo.Height - panelHeight) / 2) + this._lastWindowInfo.ScrollY; 288 289 if (y + panelHeight > this._lastWindowInfo.Height + this._lastWindowInfo.ScrollY) 290 y = this._lastWindowInfo.Height + this._lastWindowInfo.ScrollY - panelHeight; 291 292 if (y < this._lastWindowInfo.ScrollY) 293 y = this._lastWindowInfo.ScrollY; 294 295 this._modalAnimationMask.style.left = x + 'px'; 296 this._modalAnimationMask.style.top = y + 'px'; 297 298 animateTargetValue = 0; 299 animateNextValue = -panelHeight; 300 301 this._modal.style.visibility = 'visible'; 302 this._modalAnimationMask.style.visibility = 'visible'; 303 this._modalAnimationMask.style.overflow = 'hidden'; 304 305 // detect and hide select boxes 306 if (this._modalAnimationMask.getClientRects) 307 { 308 var selectBoxes = document.getElementsByTagName('select'); 309 this._hiddenSelects = new Array(); 310 for (var i = 0; i < selectBoxes.length; i++) 311 { 312 this._hiddenSelects[this._hiddenSelects.length] = { Element: selectBoxes[i], Visibility: selectBoxes[i].style.visibility }; 313 selectBoxes[i].style.visibility = 'hidden'; 314 } 315 } 316 317 this._isOpening = true; 318 if (ignoreCloseAndAnimation) 319 this._animationHandle = window.setTimeout(new Function(this._variableName + '._animate(0,0,0,0);'), 9); 320 else 321 { 322 this._modalIframe.style.display = 'none'; 323 this._animate(0, -panelHeight, panelHeight / 3, .67); 324 } 325 326 this._lastModalInfo = { Url : this._modalIframe.src, OnCloseFunction : onCloseFunction, X : x, Y : y, Width : parseInt(width, 10), Height: parseInt(height, 10) }; 327 this._isShown = true; 328} 329 330Wo_Modal._checkForScrollResize = function() 331{ 332 if (this._checkForScrollResizeHandle) 333 window.clearTimeout(this._checkForScrollResizeHandle); 334 335 if (this._isShown && !this._isOpening && this._lastWindowInfo) 336 { 337 try 338 { 339 this._modalTitle.childNodes[1].innerHTML = this._modalIframe.contentWindow.document.title; 340 } 341 catch (err) 342 { 343 } 344 345 var windowInfo = this._getWindowInfo(); 346 if (windowInfo.ScrollX != this._lastWindowInfo.ScrollX || windowInfo.ScrollY != this._lastWindowInfo.ScrollY || windowInfo.Width != this._lastWindowInfo.Width || windowInfo.Height != this._lastWindowInfo.Height) 347 this.Open(null, this._lastModalInfo.Width, this._lastModalInfo.Height, this._lastModalInfo.OnCloseFunction, this._lastModalInfo.X, this._lastModalInfo.Y, true); 348 else 349 this._checkForScrollResizeHandle = window.setTimeout(new Function('window.' + this._variableName + '._checkForScrollResize();'), 999); 350 } 351} 352 353Wo_Modal.Close = function(returnValue) 354{ 355 if (this._isShown) 356 { 357 if (!this._initialized) 358 this._initialize(); 359 360 this._modal.style.position = 'absolute'; 361 this._modal.style.display = 'none'; 362 this._modalAnimationMask.style.position = 'absolute'; 363 this._modalAnimationMask.style.display = 'none'; 364 this._modalMask.style.position = 'absolute'; 365 this._modalMask.style.display = 'none'; 366 this._modalIframe.src = this.LoadingHtmlUrl; 367 368 var onCloseFunction = this._lastModalInfo.OnCloseFunction; 369 370 this._isShown = false; 371 this._lastModalInfo = null; 372 this._windowInfo = null; 373 374 if (this._hiddenSelects) 375 { 376 for (var i = 0; i < this._hiddenSelects.length; i++) 377 { 378 if (this._hiddenSelects[i].Element.style.visibility == 'hidden') 379 this._hiddenSelects[i].Element.style.visibility = this._hiddenSelects[i].Visibility; 380 } 381 382 this._hiddenSelects = null; 383 } 384 385 if (onCloseFunction) 386 onCloseFunction(returnValue); 387 388 this.Dispose(); 389 } 390} 391 392Wo_Modal.Refresh = function() 393{ 394 if (this._animationHandle) 395 window.clearTimeout(this._animationHandle); 396 397 this.Dispose(); 398 399 if (this._isShown && this._lastModalInfo) 400 this.Open(this._lastModalInfo.Url, this._lastModalInfo.Width, this._lastModalInfo.OnCloseFunction, this._lastModalInfo.Height, this._lastModalInfo.OnCloseFunction, this._lastModalInfo.X, this._lastModalInfo.Y); 401} 402 403Wo_Modal._initialize = function() 404{ 405 this._modalMask = document.createElement('div'); 406 this._modalMask.style.width = 'auto'; 407 this._modalMask.style.height = 'auto'; 408 this._modalMask.style.position = 'absolute'; 409 this._modalMask.style.display = 'none'; 410 411 var mm = this._modalMask; 412 if (this.WindowMaskCssClasses.length > 0) 413 { 414 mm.className = this.WindowMaskCssClasses[0]; 415 for (var i = 1; i < this.WindowMaskCssClasses.length; i++) 416 { 417 mm.appendChild(document.createElement('div')); 418 mm = mm.childNodes[0]; 419 mm.className = this.WindowMaskCssClasses[i]; 420 mm.style.width = 'auto'; 421 mm.style.height = 'auto'; 422 } 423 } 424 425 document.body.appendChild(this._modalMask); 426 427 this._modalAnimationMask = document.createElement('div'); 428 this._modalAnimationMask.style.position = 'absolute'; 429 this._modalAnimationMask.style.display = 'none'; 430 this._modalAnimationMask.style.overflow = 'hidden'; 431 432 this._modal = document.createElement('div'); 433 this._modal.style.width = 'auto'; 434 this._modal.style.height = 'auto'; 435 this._modal.style.position = 'absolute'; 436 this._modal.style.display = 'none'; 437 438 var m = this._modal; 439 if (this.WindowCssClasses.length > 0) 440 { 441 m.className = this.WindowCssClasses[0]; 442 for (var i = 1; i < this.WindowCssClasses.length; i++) 443 { 444 m.appendChild(document.createElement('div')); 445 m = m.childNodes[0]; 446 m.className = this.WindowCssClasses[i]; 447 m.style.width = 'auto'; 448 m.style.height = 'auto'; 449 } 450 } 451 452 this._modalTitle = document.createElement('div'); 453 m.appendChild(this._modalTitle); 454 if (this.WindowTitleCssClasses.length > 0) 455 { 456 this._modalTitle.className = this.WindowTitleCssClasses[0]; 457 for (var i = 1; i < this.WindowTitleCssClasses.length; i++) 458 { 459 this._modalTitle.appendChild(document.createElement('div')); 460 this._modalTitle = this._modalTitle.childNodes[0]; 461 this._modalTitle.className = this.WindowTitleCssClasses[i]; 462 } 463 } 464 this._modalTitle.onmousedown = new Function('event', 'window.' + this._variableName + '._startDrag(event); return false;'); 465 466 this._modalClose = document.createElement('div'); 467 this._modalTitle.appendChild(this._modalClose); 468 469 var mc = this._modalClose; 470 if (this.WindowCloseCssClasses.length > 0) 471 { 472 mc.className = this.WindowCloseCssClasses[0]; 473 for (var i = 1; i < this.WindowCloseCssClasses.length; i++) 474 { 475 mc.appendChild(document.createElement('div')); 476 mc = mc.childNodes[0]; 477 mc.className = this.WindowCloseCssClasses[i]; 478 } 479 } 480 481 this._modalClose.onclick = new Function('window.' + this._variableName + '.Close();'); 482 483 this._modalTitle.appendChild(document.createElement('span')); 484 485 var e = document.createElement('div'); 486 e.style.clear = 'both'; 487 this._modalTitle.appendChild(e); 488 489 this._modalContent = document.createElement('div'); 490 m.appendChild(this._modalContent); 491 if (this.WindowContentCssClasses.length > 0) 492 { 493 this._modalContent.className = this.WindowContentCssClasses[0]; 494 for (var i = 1; i < this.WindowContentCssClasses.length; i++) 495 { 496 this._modalContent.appendChild(document.createElement('div')); 497 this._modalContent = this._modalContent.childNodes[0]; 498 this._modalContent.className = this.WindowContentCssClasses[i]; 499 } 500 } 501 502 this._modalIframe = document.createElement('iframe'); 503 this._modalIframe.src = this.LoadingHtmlUrl; 504 this._modalIframe.width = '100%'; 505 this._modalIframe.border = '0'; 506 this._modalIframe.frameBorder = 'no'; 507 this._modalIframe.style.borderLeftWidth = '0px'; 508 this._modalIframe.style.borderRightWidth = '0px'; 509 this._modalIframe.style.borderTopWidth = '0px'; 510 this._modalIframe.style.borderBottomWidth = '0px'; 511 this._modalContent.appendChild(this._modalIframe); 512 513 this._modalFooter = document.createElement('div'); 514 m.appendChild(this._modalFooter); 515 var mf = this._modalFooter; 516 if (this.WindowFooterCssClasses.length > 0) 517 { 518 mf.className = this.WindowFooterCssClasses[0]; 519 for (var i = 1; i < this.WindowFooterCssClasses.length; i++) 520 { 521 mf.appendChild(document.createElement('div')); 522 mf = mf.childNodes[0]; 523 mf.className = this.WindowFooterCssClasses[i]; 524 } 525 } 526 527 this._modalResize = document.createElement('div'); 528 mf.appendChild(this._modalResize); 529 530 var e = document.createElement('div'); 531 e.style.clear = 'both'; 532 mf.appendChild(e); 533 534 var mr = this._modalResize; 535 if (this.WindowResizeCssClasses.length > 0) 536 { 537 mr.className = this.WindowResizeCssClasses[0]; 538 for (var i = 1; i < this.WindowResizeCssClasses.length; i++) 539 { 540 mr.appendChild(document.createElement('div')); 541 mr = mr.childNodes[0]; 542 mr.className = this.WindowResizeCssClasses[i]; 543 } 544 } 545 546 this._modalResize.onmousedown = new Function('event', 'window.' + this._variableName + '._startResize(event); return false;'); 547 548 this._modalAnimationMask.appendChild(this._modal); 549 550 document.body.appendChild(this._modalAnimationMask); 551 552 this._initialized = true; 553} 554 555Wo_Modal.Dispose = function() 556{ 557 if (this._initialized) 558 { 559 if (this._animationHandle) 560 window.clearTimeout(this._animationHandle); 561 562 this._isShown = false; 563 this._isOpening = false; 564 565 if (document && document.body) 566 { 567 document.body.removeChild(this._modalAnimationMask); 568 document.body.removeChild(this._modalMask); 569 this._modalClose.onclick = null; 570 this._modalTitle.onmousedown = null; 571 this._modalResize.onmousedown = null; 572 this._modal = null; 573 this._modalTitle = null; 574 this._modalClose = null; 575 this._modalAnimationMask = null; 576 this._modalMask = null; 577 this._modalIframe = null; 578 this._modalResize = null; 579 this._modalFooter = null; 580 this._modalContent = null; 581 } 582 583 this._initialized = false; 584 } 585} 586 587Wo_Modal._animate = function(targetValue, nextValue, step, acceleration) 588{ 589 if (this._animationHandle) 590 window.clearTimeout(this._animationHandle); 591 592 if (!this._isOpening) 593 return; 594 595 var currValue = parseInt(this._modal.style.top, 10); 596 if ((step < 0 && currValue < targetValue) || (step > 0 && currValue > targetValue) || Math.abs(step) < 1) 597 { 598 // complete 599 if (this._hiddenSelects) 600 { 601 for (var i = 0; i < this._hiddenSelects.length; i++) 602 this._hiddenSelects[i].Element.style.visibility = 'hidden'; 603 } 604 605 this._modal.style.top = targetValue + 'px'; 606 this._modal.style.position = 'static'; 607 this._modalAnimationMask.style.overflow = 'visible'; 608 this._animationHandle = null; 609 610 if (!this._isResizing && !this._isDragging) 611 this._modalIframe.style.display = 'block'; 612 613 this._isOpening = false; 614 615 this._lastWindowInfo = this._getWindowInfo(); 616 this._checkForScrollResizeHandle = window.setTimeout(new Function('window.' + this._variableName + '._checkForScrollResize();'), 999); 617 } 618 else 619 { 620 // continue animation 621 this._modal.style.top = nextValue + 'px'; 622 623 nextValue = nextValue + step; 624 if (step > 0 && nextValue > targetValue) 625 nextValue = targetValue; 626 else if (step < 0 && nextValue < targetValue) 627 nextValue = targetValue; 628 629 step = step * acceleration; 630 631 this._animationHandle = window.setTimeout(new Function(this._variableName + '._animate(' + targetValue + ',' + nextValue + ',' + step + ',' + acceleration + ');'), 19); 632 } 633} 634 635Wo_Modal._startDrag = function(event) 636{ 637 if (!this._initialized) 638 this._initialize(); 639 640 if (!event) 641 event = window.event; 642 643 this._moveModalInfo = new Object(); 644 645 this._moveModalInfo.StartMouseX = event.pageX ? event.pageX : event.screenX; 646 this._moveModalInfo.StartMouseY = event.pageY ? event.pageY : event.screenY; 647 this._moveModalInfo.StartModalX = this._lastModalInfo.X; 648 this._moveModalInfo.StartModalY = this._lastModalInfo.Y; 649 this._moveModalInfo.Button = event.button; 650 651 document.onmouseup = new Function('event', 'window.' + this._variableName + '._endDrag(event); return false;'); 652 document.onmousemove = new Function('event', 'window.' + this._variableName + '._drag(event); return false;'); 653 654 this._modalIframe.style.display = 'none'; 655 this._isDragging = true; 656} 657 658Wo_Modal._endDrag = function(event) 659{ 660 if (!this._initialized) 661 this._initialize(); 662 663 this._isDragging = false; 664 this._moveModalInfo = null; 665 document.onmouseup = null; 666 document.onmousemove = null; 667 this._modalIframe.style.display = 'block'; 668} 669 670Wo_Modal._drag = function(event) 671{ 672 if (!this._initialized) 673 this._initialize(); 674 675 if (!event) 676 event = window.event; 677 678 if (event.button != this._moveModalInfo.Button) 679 { 680 this._endDrag(event); 681 return; 682 } 683 684 var eventX = typeof(event.pageX) != 'undefined' ? event.pageX : event.screenX; 685 var eventY = typeof(event.pageY) != 'undefined' ? event.pageY : event.screenY; 686 687 var xChange = eventX - this._moveModalInfo.StartMouseX; 688 var yChange = eventY - this._moveModalInfo.StartMouseY; 689 690 this.Open(null, this._lastModalInfo.Width, this._lastModalInfo.Height, this._lastModalInfo.OnCloseFunction, this._moveModalInfo.StartModalX + xChange, this._moveModalInfo.StartModalY + yChange, true); 691} 692 693Wo_Modal._startResize = function(event) 694{ 695 if (!this._initialized) 696 this._initialize(); 697 698 if (!event) 699 event = window.event; 700 701 this._resizeModalInfo = new Object(); 702 703 this._resizeModalInfo.StartMouseX = event.pageX ? event.pageX : event.screenX; 704 this._resizeModalInfo.StartMouseY = event.pageY ? event.pageY : event.screenY; 705 this._resizeModalInfo.StartModalWidth = this._lastModalInfo.Width; 706 this._resizeModalInfo.StartModalHeight = this._lastModalInfo.Height; 707 this._resizeModalInfo.Button = event.button; 708 709 document.onmouseup = new Function('event', 'window.' + this._variableName + '._endResize(event); return false;'); 710 document.onmousemove = new Function('event', 'window.' + this._variableName + '._resize(event); return false;'); 711 712 this._modalIframe.style.display = 'none'; 713 this._isResizing = true; 714} 715 716Wo_Modal._endResize = function(event) 717{ 718 if (!this._initialized) 719 this._initialize(); 720 721 this._isResizing = false; 722 this._resizeModalInfo = null; 723 document.onmouseup = null; 724 document.onmousemove = null; 725 this._modalIframe.style.display = 'block'; 726} 727 728Wo_Modal._resize = function(event) 729{ 730 if (!this._initialized) 731 this._initialize(); 732 733 if (!event) 734 event = window.event; 735 736 if (event.button != this._resizeModalInfo.Button) 737 { 738 this._endResize(event); 739 return; 740 } 741 742 var eventX = typeof(event.pageX) != 'undefined' ? event.pageX : event.screenX; 743 var eventY = typeof(event.pageY) != 'undefined' ? event.pageY : event.screenY; 744 745 var xChange = eventX - this._resizeModalInfo.StartMouseX; 746 var yChange = eventY - this._resizeModalInfo.StartMouseY; 747 748 this.Open(null, this._resizeModalInfo.StartModalWidth + xChange, this._resizeModalInfo.StartModalHeight + yChange, this._lastModalInfo.OnCloseFunction, this._lastModalInfo.X, this._lastModalInfo.Y, true); 749} 750 751Wo_Modal.Configure('js/loading.html',['CommonModal'],['CommonModalTitle'],['CommonModalClose'],['CommonModalContent'],['CommonModalFooter'],['CommonModalResize'],['CommonModalMask'],100); 752
还没有找到您心仪的内容?请用.net源码大搜捕
代码片断 打包下载该项目完整源码:WO@BIZ第一季1.2版源码
51Aspx.com 版权所有 CopyRight © 2006-2010. 京ICP备06046876号 本站法律顾问:ITlaw-庄毅雄律师
返回顶部
客户服务:点击这里进行客户咨询 业务合作:点击这里洽谈业务合作 合作热线:010-68880146