这是javascript
我目前正在使用的代码:
function toggleContainer(containerID, hideContainerIDs) {
if(hideContainerIDs) {
for(var i=0; i<hideContainerIDs.length; i++) {
ajaxChat.showHide(hideContainerIDs[i], 'none');
}
}
ajaxChat.showHide(containerID);
if(typeof arguments.callee.styleProperty == 'undefined') {
if(typeof isIElt7 != 'undefined') {
arguments.callee.styleProperty = 'marginRight';
} else {
arguments.callee.styleProperty = 'right';
}
}
var containerWidth = document.getElementById(containerID).offsetWidth;
if(containerWidth) {
document.getElementById('chatList').style[arguments.callee.styleProperty] = (containerWidth+28)+'px';
document.getElementById('chatBooth').style[arguments.callee.styleProperty] = (containerWidth+28)+'px';
} else {
document.getElementById('chatList').style[arguments.callee.styleProperty] = '20px';
document.getElementById('chatBooth').style[arguments.callee.styleProperty] = '20px';
}
}
DIV 和 IFrame 代码:
<div id="chatBooth" style="display:none; overflow: hidden;">
<iframe style="overflow:hidden;height:100%;width:100%" height="100%" width="100%" frameborder="0" scrolling="no" name="booth" id="booth" src="about:blank">
</iframe>
</div>
我已经尝试了我能想到的一切,这段代码在每个浏览器中都有效,但是IE
. 它所做的是,当您单击当前可见的窗口内的链接时,它会在 hidden 中加载一个新页面IFrame
,并且您可以通过IFrame
单击按钮使其可见。这是显示和隐藏隐藏DIV
和的按钮IFrame
。
<input type="button" value="[LANG]toggleChat[/LANG]" title="[LANG]toggleTitleChat[/LANG]" alt="[LANG]toggleChat[/LANG]" onclick="ajaxChat.showHide('chatBooth', null);"/>
这是Link
更改应该位于IFrame
每个浏览器中的内容的代码,但是IE
!
alert(this.channelName);
document.getElementById('booth').contentWindow.location.reload(true);
document.getElementById('booth').src = 'http://www.cnn.com';
上面的代码适用于除IE
. 我完全不知所措。我花了几个小时Google
搜寻,似乎找不到解决方案,甚至找不到导致问题的原因。任何帮助将不胜感激。
这是请求的 showHide 代码:
showHide: function(id, styleDisplay, displayInline) {
var node = document.getElementById(id);
if(node) {
if(styleDisplay) {
node.style.display = styleDisplay;
} else {
if(node.style.display == 'none') {
node.style.display = (displayInline ? 'inline' : 'block');
} else {
node.style.display = 'none';
}
}
}
}
用于重新加载 iframe 和更改 iframe SRC 的代码
document.getElementById('booth').contentWindow.location.reload(true);
document.getElementById('booth').src = 'http://www.WEBSITE.com'+ ajaxChatConfig.loginChannelName +'/index.html';
上面似乎不允许 IE 在 IFrame 中加载任何内容,即使它被告知这样做。