473,544 Members | 1,928 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

dynamic src of 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(t imeEntryID, dayID, e) {
var x = e.clientX;
var y = e.clientY;
ew = frames['editPop'];
eF = getObj('editPop ID');
eF.style.left = x + 10;
eF.style.top = y + 10;
window.top.fram es['editPopID'].location.href =
"controls/editPopup.aspx? id=" + timeEntryID + "&did=" + dayID;
ShowFrame();
}

function ShowFrame() {
if (eF.style.displ ay=="none") {
eF.style.displa y="black"; // FF Drawing bug
}
eF.style.visibi lity="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

Jul 23 '05 #1
10 15336
dko...@gmail.co m wrote:
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(t imeEntryID, dayID, e) {
var x = e.clientX;
var y = e.clientY;
ew = frames['editPop'];
eF = getObj('editPop ID');
eF.style.left = x + 10;
eF.style.top = y + 10;
window.top.fram es['editPopID'].location.href =
"controls/editPopup.aspx? id=" + timeEntryID + "&did=" + dayID;
ShowFrame();
}

function ShowFrame() {
if (eF.style.displ ay=="none") {
eF.style.displa y="black"; // FF Drawing bug
}
eF.style.visibi lity="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


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...a nyway, the frame object is
referenced via the frame name, not its id as the element object is.

window.top.fram es['editPop'].location.href = ....
(or ew.location.hre f = ....)

<iframe name="editPop". ..>

Typo?

eF.style.displa y="black" <-----

Jul 23 '05 #2
dk****@gmail.co m wrote:
<snip>
window.top.fram es['editPopID'].location.href =
"controls/editPopup.aspx? id=" + timeEntryID + "&did=" + dayID; <snip> ... just shows about:blank ...

<snip>

All else aside, if you have an IFRAME with "about:blan k" 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.
Jul 23 '05 #3
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.fr ames["editPop"].location = "http://website/address/here"
window.top.fram es["editPop"].location = "http://website/address/here"

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

Jul 23 '05 #4
dko...@gmail.co m wrote:
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.fr ames["editPop"].location = "http://website/address/here" window.top.fram es["editPop"].location = "http://website/address/here"

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


How about...

window.self.top .parent.documen t.frames["editPop"].location.href. com

Seriously...not to beat a dead iframe...

RobB wrote:
Didn't post your HTML -which leaves people
to guess what all those identifiers correspond to.


Your HTML here is the architectural blueprint to the structure of your
document(s). Better to analyze it than just string references together
and pray.

Jul 23 '05 #5
dk****@gmail.co m wrote:
window.top.fram es['editPopID'].location.href =
"controls/editPopup.aspx? id=" + timeEntryID + "&did=" + dayID;


Have you tried?
top.document.ge tElementById('e ditPopID').src = "http://yourPageHere";

Csaba Gabor from Vienna
Jul 23 '05 #6
HA!

top.document.ge tElementyById(' editPopID').src worked.

what a task! thank you very much for your help!

Jul 23 '05 #7
Csaba Gabor wrote:
dk****@gmail.co m wrote:
window.top.fram es['editPopID'].location.href =
"controls/editPopup.aspx? id=" + timeEntryID +
"&did=" + dayID;


Have you tried?
top.document.ge tElementById('e ditPopID').src =
"http://yourPageHere";


It seems a bit unfair to take someone who is probably making a trivial
error (or suffering a minor misconception) in their use of a reliable
cross-browser technique for navigating a frame and sending them off with
an alternative that is significantly less well supported and should not
be expected to work at all according to the applicable standard.

Richard.
Jul 23 '05 #8
Richard Cornford wrote:
Csaba Gabor wrote:
dk****@gmail.co m wrote:
window.top.fram es['editPopID'].location.href =
"controls/editPopup.aspx? id=" + timeEntryID +
"&did=" + dayID;
Have you tried?
top.document.ge tElementById('e ditPopID').src =
"http://yourPageHere";


It seems a bit unfair to take someone who is probably making a trivial
error (or suffering a minor misconception) in their use of a reliable
cross-browser technique for navigating a frame and sending them off with
an alternative that is significantly less well supported


Full ACK
and should not be expected to work at all according to the applicable
standard.


NAK. According to the "applicable standard" (DOM Level 2+), DOM Level 0
references not specified therein should not work at all in HTML user
agents, so the first version should ultimately fail. However, it does
usually work and it does not fail. And since both this is the case and
recent UAs implement interfaces of the W3C DOM, I would consider the
second version somewhat nearer to the "standards" than the first.
(Although I would not recommend it at the moment for the reasons given
above.)

Consider this: (window.)top is proprietary but widely supported (DOM Level
0), and if the Window object referred to by it implemented DOM Level 2
Views it had a `document' property, and if the object referred to by it
would implement the Document interface (interestingly, e.g. the Gecko DOM
implementation yields an object with the prototype HTMLDocument while this
is an identifier of an interface inheriting from Document in DOM Level 2
HTML) and so it would have a getElementById( ) method which application
with the above argument would return an object implementing the
HTMLIFrameEleme nt interface (which e.g. the Gecko DOM provides) which
would have a `src' property that is not read-only.
PointedEars
Jul 23 '05 #9
Thomas 'PointedEars' Lahn wrote:
Richard Cornford wrote: <snip>
and should not be expected to work at all according to
the applicable standard.

<snip> ... HTMLIFrameEleme nt interface (which e.g.
the Gecko DOM provides) which would have a
`src' property that is not read-only.


<quote cite="W3C Level 2 HTML DOM; HTMLIFrameEleme nt interface">
src - of type DOMString
A URI [IETF RFC 2396] designating the initial frame contents. See the
src attribute definition in HTML 4.01.
</quote>

It may not be read-only but what does it mean to assign a URI to "the
initial frame contents"? Now if the spec said "current frame contents"
then an assignment to - src - might be expected to result in navigation,
but assigning to the initial content would do what? A frame can only
have one "initial frame contents".

As a means of navigation, assigning a value to the - src - property of
an IFRAME element should not be expected to work, according to the
applicable standard.

Richard.
Jul 23 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
9351
by: Csaba2000 | last post by:
I want to be able to embed a single quote into an INPUT element within a dynamically generated IFRAME. The example below shows how the IFRAME is generated. Challenge: I'd like the alert box to show: Mom said, "Don't" instead of the current: Mom said, "Do not". The point of the exercise is that I will be passing arbitrary strings to the...
26
3201
by: shlomi.schwartz | last post by:
using this example: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Test Page</title> </head>
8
5355
by: hyejin | last post by:
I have a problem with dynamic iframe and document.close() on Firefox. Below two files create a dynamic iframe by JavaScript. These two samples do not have any problems on IE. But, on Firefox, the icon on the top corner keeps running with "loading" message on the bottom status bar even though the browser completed everything in the iFrame. ...
1
5355
by: mike888 | last post by:
I want to create dynamic iframe content like below but in Firefox <iframe width="100%" height="100" src="#"></iframe> <script language="JavaScript"><!-- document.frames.document.open(); document.frames.document.write('THis is the dynamic text for iframe above'); document.frames.document.close();
1
6877
by: redbaks | last post by:
Hi! I am trying to implement adding widgets to our template editor (for blogs). I am worried that i might open a window for XSS attacks so i decided to enveloped all widgets inside an iframe. whenever a user wants to insert an external widget to his blog, a script takes over and it will create a dynamic iframe and then the widget script...
3
5368
polymorphic
by: polymorphic | last post by:
I have succeeded in embedding PDF files in a dynamic iframe. The problem is that I need the PDF to cache. If the PDF remains the same from page load to page load then the pdf is somehow cached with the html page. But if I try to navigate to another pdf in the IFRAME then no caching occurs. Is the problem in the IFRAME reloading instead of just...
1
4880
by: cdmsenthil | last post by:
I have an Infragistics UltrawebGrid . Each Row in the grid is attached to a context menu using Infragistics CSOM Upon click on the menu, I am creating an Iframe dynamically which points to another page in the same domain which also contains infragistics datagid populated with default data retrieved from Data Base. After creating the frame I...
0
7373
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7625
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7717
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5306
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4930
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3421
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1848
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
993
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
677
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.