IFRAME的动态src

扫码查看
本文介绍了IFRAME的动态src的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在试图设置一个用户点击某个链接时显示的

IFRAME的src(location.href)我的头发:


函数editTimeEntry(timeEntryID,dayID,e){

var x = e.clientX;

var y = e.clientY;

ew = frames [''editPop''];

eF = getObj(''editPopID'');

eF.style.left = x + 10;

eF.style.top = y + 10;

window.top.frames [''editPopID'']。location.href =

controls / editPopup.aspx?id =" + timeEntryID +"& did =" + dayID;

ShowFrame();

}


函数ShowFrame(){

if (eF.style.display ==" none"){

eF.style.display =" black" ;; // FF绘图错误

}

eF.style.visibility =" visible";

alert(" Location:" + document.frames [''editPop'']。location.href);

}


当显示IFRAME时,它只显示 :空白而不是我设置的

location.href。第一次之后,我点击相同的

链接,它在

ShowFrame()的警告框中显示正确的地址,但iframe仍为空白。任何人都可以指向

正确的文档或帮助我吗?非常感谢。

谢谢。


肖恩

I am ripping my hair out trying to set the src (location.href) of an
IFRAME that i show once a user clicks on a certain link:

function editTimeEntry(timeEntryID, dayID, e) {
var x = e.clientX;
var y = e.clientY;
ew = frames[''editPop''];
eF = getObj(''editPopID'');
eF.style.left = x + 10;
eF.style.top = y + 10;
window.top.frames[''editPopID''].location.href =
"controls/editPopup.aspx?id=" + timeEntryID + "&did=" + dayID;
ShowFrame();
}

function ShowFrame() {
if (eF.style.display=="none") {
eF.style.display="black"; // FF Drawing bug
}
eF.style.visibility="visible";
alert("Location:" + document.frames[''editPop''].location.href);
}

When the IFRAME is displayed it just shows about:blank and not the
location.href I set for it. After the first time, i click on the same
link and it shows me the correct address in the alert box in
ShowFrame(), but the iframe remains blank. can anyone point me to the
right documentation or help me out? It would be greatly appreciated.
Thank you.

Sean

推荐答案




没有发布你的HTML - 这让人们去了猜猜所有那些

标识符对应的是什么。你在那里处理*两个*对象:一个

帧(窗口)对象,它的Location对象(location属性),

和一个元素对象,通过 - erm - src

属性设置iframe src。不清楚为什么所有重复...无论如何,框架对象是通过框架名称引用的
,而不是它作为元素对象的id。


窗口.top.frames [''editPop'']。location.href = ....

(或ew.location.href = ....)


< iframe name =" editPop" ...>


错字?


eF.style.display =" ;黑色" < -----



Didn''t post your HTML -which leaves people to guess what all those
identifiers correspond to. You''re dealing with *two* objects there: a
frame (window) object, with its Location object (location property),
and an element object, which sets the iframe src via its - erm - src
property. Unclear why all the duplication...anyway, the frame object is
referenced via the frame name, not its id as the element object is.

window.top.frames[''editPop''].location.href = ....
(or ew.location.href = ....)

<iframe name="editPop"...>

Typo?

eF.style.display="black" <-----




< snip>


除此之外,如果您的IFRAME为约 :空白当你为相应的位置对象分配一个相对URL时,你的SRC,

你期望这个URL是相对的吗?


理查德。


<snip>

All else aside, if you have an IFRAME with "about:blank" as its SRC,
when you assign a relative URL to the corresponding location object what
are you expecting that URL to be relative to?

Richard.



这篇关于IFRAME的动态src的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 11:52
查看更多