0
我有一個透明單位iframe中,其通過下一個JS函數創建:JavaScript的:通過ImageClick透明的iframe
Frames.prototype.CreateIframe = function (frameName, frWidth, frHeight, zindex) {
var frameObj = document.createElement('iframe');
frameObj.width = PX(frWidth);
frameObj.src = 'Content.htm';
frameObj.height = PX(frHeight);
frameObj.id = frameName;
frameObj.name = frameName;
frameObj.frameBorder = 0;
frameObj.allowTransparency = 'allowtransparency';
frameObj.style.zIndex = zindex;
frameObj.style.position = 'absolute';
frameObj.style.scrolling = 'no';
frameObj.style.scroll = 'no';
frameObj.style.overflow = 'hidden';
frameObj.style.left = PX(0);
frameObj.style.top = PX(0);
GlobalClass.AppendChild(window, frameObj);
}
在其下面是其中圖像被放置在另一個iframe中。我爲這些圖像創建了事件處理程序。例如document.GetElementById("MyImage").onclick(alert("Click!"));
如果我通過IE來運行它,一切工作正常。但我通過Chrome,Firefox,Opera運行它沒有任何作用。 我該如何解決這個問題? 上面的透明iframe具有事件處理程序,它也適用於IE。