open$iframe.Open = function (url, width, height, onCloseFunction, x, y, ignoreCloseAndAnimation)
{
if (!ignoreCloseAndAnimation && this._isShown)
this.Close();
else if (this._hiddenSelects)
{
for (var i = 0; i < this._hiddenSelects.length; i++)
{
if (this._hiddenSelects[i].Element.style.visibility == 'hidden')
this._hiddenSelects[i].Element.style.visibility = this._hiddenSelects[i].Visibility;
}

this._hiddenSelects = null;
}

if (!this._initialized)
this._initialize();

try
{
this._modalTitle.childNodes[1].innerHTML = this._modalIframe.contentWindow.document.title;
}
catch (err)
{
}

if (!ignoreCloseAndAnimation)
this._modalIframe.src = url;

try
{
this._modalIframe.contentWindow.opener = window;
}
catch (err)
{
}

this._modalAnimationMask.style.display = 'none';
this._modalMask.style.display = 'none';

// retrieve the window info
this._lastWindowInfo = this._getWindowInfo();

this._modalAnimationMask.style.display = 'block';

// width/height of panel
if (width > this._lastWindowInfo.Width)
width = this._lastWindowInfo.Width;

this._modalAnimationMask.style.position = 'absolute';
this._modalAnimationMask.style.zIndex = this.ZIndex;
this._modalAnimationMask.style.display = 'block';
this._modalAnimationMask.style.visibility = 'hidden';
this._modalAnimationMask.style.overflow = 'hidden';

this._modalAnimationMask.style.width = width + 'px';
this._modalContent.style.width = width + 'px';

this._modal.style.position = 'absolute';
this._modal.style.display = 'block';
this._modal.style.visibility = 'hidden';
this._modal.style.left = '0px';
this._modal.style.top = '0px';

this._modalMask.style.position = 'absolute';
this._modalMask.style.display = 'block';
this._modalMask.style.zIndex = this.ZIndex;
this._modalMask.style.visibility = 'visible';

var modalContentOffset = this._calculateStyleOffset(this._modalContent);

var offset = (this._modal.offsetHeight - this._modalContent.offsetHeight) - modalContentOffset.Height;
if (height + offset > this._lastWindowInfo.Height)
height = this._lastWindowInfo.Height - offset;

if (width < this._modalResize.offsetWidth * 2)
width = this._modalResize.offsetWidth * 2;

if (width < this._modalClose.offsetWidth * 2)
width = this._modalClose.offsetWidth * 2;

if (height < this._modalTitle.offsetHeight + this._modalFooter.offsetHeight)
height = this._modalTitle.offsetHeight + this._modalFooter.offsetHeight;

this._modalIframe.style.height = height + 'px';
this._modalContent.style.height = height + 'px';
this._modalContent.style.width = (width - (this._modal.offsetWidth - this._modalContent.offsetWidth) - modalContentOffset.Width) + 'px';
this._modalAnimationMask.style.width = width + 'px';
this._modalAnimationMask.style.height = this._modal.offsetHeight + 'px';

this._modalMask.style.left = '0px';
this._modalMask.style.top = '0px';
this._modalMask.style.width = this._lastWindowInfo.ContentWidth + 'px';
this._modalMask.style.height = this._lastWindowInfo.ContentHeight + 'px';

this._lastWindowInfo = this._getWindowInfo();

var panelWidth = this._modal.offsetWidth;
var panelHeight = this._modal.offsetHeight;
var animatePropertyName, animateTargetValue, animateNextValue;

if (typeof(x) == 'undefined' || isNaN(parseInt(x, 10)))
x = ((this._lastWindowInfo.Width - panelWidth) / 2) + this._lastWindowInfo.ScrollX;

if (x + panelWidth > this._lastWindowInfo.Width + this._lastWindowInfo.ScrollX)
x = this._lastWindowInfo.Width + this._lastWindowInfo.ScrollX - panelWidth;

if (x < this._lastWindowInfo.ScrollX)
x = this._lastWindowInfo.ScrollX;

if (typeof(y) == 'undefined' || isNaN(parseInt(y, 10)))
y = ((this._lastWindowInfo.Height - panelHeight) / 2) + this._lastWindowInfo.ScrollY;

if (y + panelHeight > this._lastWindowInfo.Height + this._lastWindowInfo.ScrollY)
y = this._lastWindowInfo.Height + this._lastWindowInfo.ScrollY - panelHeight;

if (y < this._lastWindowInfo.ScrollY)
y = this._lastWindowInfo.ScrollY;

this._modalAnimationMask.style.left = x + 'px';
this._modalAnimationMask.style.top = y + 'px';

animateTargetValue = 0;
animateNextValue = -panelHeight;

this._modal.style.visibility = 'visible';
this._modalAnimationMask.style.visibility = 'visible';
this._modalAnimationMask.style.overflow = 'hidden';

// detect and hide select boxes
if (this._modalAnimationMask.getClientRects)
{
var selectBoxes = document.getElementsByTagName('select');
this._hiddenSelects = new Array();
for (var i = 0; i < selectBoxes.length; i++)
{
this._hiddenSelects[this._hiddenSelects.length] = { Element: selectBoxes[i], Visibility: selectBoxes[i].style.visibility };
selectBoxes[i].style.visibility = 'hidden';
}
}

this._isOpening = true;
if (ignoreCloseAndAnimation)
this._animationHandle = window.setTimeout(new Function(this._variableName + '._animate(0,0,0,0);'), 9);
else
{
this._modalIframe.style.display = 'none';
this._animate(0, -panelHeight, panelHeight / 3, .67);
} this._lastModalInfo = { Url : this._modalIframe.src, OnCloseFunction : onCloseFunction, X : x, Y : y, Width : parseInt(width, 10), Height: parseInt(height, 10) };
this._isShown = true;
}

解决方案 »

  1.   

    下面还有 算了不贴了,直接查看
    http://www.luwei.net.cn/test.htm里面是代码,点击弹出的网页是test2.htm,点击对话框的右上角可以关闭这个对话框(因为是个图片路径所以看不到)
    现在的问题是:
    1.如何点击test2.htm里的某个关闭按钮也可以这个对话框呢?
    2.不管我怎么设置test2.htm里面的样式属性,可是当test2.htm里面的内容高度高于设置的270的时候这个对话框就会有横向滚动条,改了好久也不知道为什么,如何去掉对话框的横向滚动条?各位给看看,代码直接保存为htm就可以浏览,然后还有个test2.htm随便测试,帮忙看看,谢谢
      

  2.   

    1.如何点击test2.htm里的某个关闭按钮也可以关闭这个对话框呢?
      

  3.   

    可以调用
    parent.closeWindow方法通过调用test.htm来关闭。一般通过设置display='none';2一般都是通过一个div+iframe来弹出新窗口,可以设置div或者iframe的样式禁止滚动条啊。