IFRAME的动态src [英] dynamic src of IFRAME

查看:78
本文介绍了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

推荐答案

dko ... @ gmail.com写道:
dko...@gmail.com wrote:
我正在试图设置我显示一次的
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" <-----


dk **** @ gmail.com 写道:

< snip>
dk****@gmail.com wrote:
<snip>
window.top.frames [''editPopID'']。location.href =
"控制/ editPopup.aspx ID = QUOT; + timeEntryID +"& did =" + dayID;
< snip> ...只是显示 :空白......
window.top.frames[''editPopID''].location.href =
"controls/editPopup.aspx?id=" + timeEntryID + "&did=" + dayID; <snip> ... just shows about:blank ...



< 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.


我已经尝试过一切都没有运气。它在FireFox中完美运行,

但它不适用于IE。我尝试过以下方法:


window.frames [" editPop"]。location =" http:// website / address / here"

top.frames [" editPop"]。location =" http:// website / address / here"

document.frames [" editPop"]。location =" http://网站/地址/这里"

document.top.frames [" editPop"]。location =" http:// website / address / here"

窗口。 top.frames [" editPop"]。location =" http:// website / address / here"


有谁知道我怎么能让它工作?这真的很恶心。

I have tried everything with no luck. It works perfectly in FireFox,
but it DOES NOT work in IE. I have tried the following:

window.frames["editPop"].location = "http://website/address/here"
top.frames["editPop"].location = "http://website/address/here"
document.frames["editPop"].location = "http://website/address/here"
document.top.frames["editPop"].location = "http://website/address/here"
window.top.frames["editPop"].location = "http://website/address/here"

Does anyone know how I can get this to work? It''s really aggravating.


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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆