473,415 Members | 1,566 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,415 software developers and data experts.

Timing Issue - Setting Title of IFrame Modal Dialog Window Using the Contained Window Title

I have a quirky issue that I believe involves timing and only 2 hairs left to pull.

I have a modal dialog that is an IFrame.
The IFrame contains another window - which contains the appropriate title.

I am trying to change the title of the IFrame window to be
that of the contained window title.

If I uncomment the alert statement below - the title change works.
Comment out the alert - and - no title change.

I have unsuccessfully tried using the following
methods/events as timing devices:
setTimeout, onload, onreadystatechange

The problem appears to be that I have to make the title change
before the modal window is displayed - which I cannot seem to capture.

ANY assistance is greatly appreciated...

Start of code sample:
....
<body>
<iframe id="content"
name="embeddedContent"
src="<%= request.getParameter("url")%>"
frameborder="0"
height="100%"
width="100%">
</iframe>
</body>
<script language="javascript">
var myIframe = document.getElementById("content");

if (myIframe)
{
if(myIframe.contentWindow)
{
//alert("stop now");
if(myIframe.contentWindow.document)
{
document.title = myIframe.contentWindow.document.title;
}
}
}
</script>
....

End of code sample

Thanks!
Jul 23 '05 #1
3 8094
On 8 Sep 2004 12:33:49 -0700, Russell wrote:
src="<%= request.getParameter("url")%>"


It is best not to mix Java code
into a post that is about JS.

A static HTML with the JS keeps everyone
focused and on the same 'page'.

It can also (sometimes) reveal the underlying
problem simply by unentangling the disparate
technologies involved.

...Just a thought for future posts.

Now, since I have no further ideas on the
solution, I will bow out of this thread
and leave it to the experts.

--
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology
Jul 23 '05 #2
Russell wrote:
I have a quirky issue that I believe involves timing and only 2 hairs left to pull.

I have a modal dialog that is an IFrame.
The IFrame contains another window - which contains the appropriate title.

I am trying to change the title of the IFrame window to be
that of the contained window title.

If I uncomment the alert statement below - the title change works.
Comment out the alert - and - no title change.

I have unsuccessfully tried using the following
methods/events as timing devices:
setTimeout, onload, onreadystatechange

The problem appears to be that I have to make the title change
before the modal window is displayed - which I cannot seem to capture.

ANY assistance is greatly appreciated...

Start of code sample:
....
<body>
<iframe id="content"
name="embeddedContent"
src="<%= request.getParameter("url")%>"
frameborder="0"
height="100%"
onload="setTitle()"
width="100%">
</iframe>
</body>
<script language="javascript">
<script type="text/javascript">
function setTitle(){

var myIframe = document.getElementById("content");
if (myIframe)
{
if(myIframe.contentWindow)
{
//alert("stop now");
if(myIframe.contentWindow.document)
{
document.title = myIframe.contentWindow.document.title;
}
}
}


}

Use the onload of the IFrame tag to call the function, and then wrap
your script in a function.

Tested in Mozilla, IE and Opera.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq
Jul 23 '05 #3
Randy Webb <Hi************@aol.com> wrote in message news:<J6********************@comcast.com>...
Russell wrote:
I have a quirky issue that I believe involves timing and only 2 hairs left to pull.

I have a modal dialog that is an IFrame.
The IFrame contains another window - which contains the appropriate title.

I am trying to change the title of the IFrame window to be
that of the contained window title.

If I uncomment the alert statement below - the title change works.
Comment out the alert - and - no title change.

I have unsuccessfully tried using the following
methods/events as timing devices:
setTimeout, onload, onreadystatechange

The problem appears to be that I have to make the title change
before the modal window is displayed - which I cannot seem to capture.

ANY assistance is greatly appreciated...

Start of code sample:
....
<body>
<iframe id="content"
name="embeddedContent"
src="<%= request.getParameter("url")%>"
frameborder="0"
height="100%"


onload="setTitle()"
width="100%">
</iframe>
</body>
<script language="javascript">


<script type="text/javascript">
function setTitle(){

var myIframe = document.getElementById("content");
if (myIframe)
{
if(myIframe.contentWindow)
{
//alert("stop now");
if(myIframe.contentWindow.document)
{
document.title = myIframe.contentWindow.document.title;
}
}
}


}

Use the onload of the IFrame tag to call the function, and then wrap
your script in a function.

Tested in Mozilla, IE and Opera.


Thank you but... I tried adding the onload to the iframe and it still
did not work. However - after several days of searching (four to be
exact)- I did find another way to handle my problems. The reason I
was using an iframe was because everyone told me I needed to when
using a modal dialog that posted back to itself. The modal window
would actually open up a new window instead of posting back to itself.
Several places on the internet and some internal employees all told
me I had to use an iframe. After 4 wasted days of struggling through
trying to get the title (with no luck might I add) I happened upon
someone's single line of code solution - <base target="_self">.
I got rid of the iframe - and have no problems whatsoever. I have my
titles and my window is posting to itself rather than opening a new
one - so life is
good again.

Thank you all who responded - any and all responses were greatly
appreciated.
Jul 23 '05 #4

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

Similar topics

2
by: Patrick Lim | last post by:
Here is the problem: I have written a non-modal frame class in Java for displaying help text when a user is using an application. It works as desired in that if the user selects "help" again,...
4
by: Marina Ferguson | last post by:
Hi, I have a document with an iframe. The main doc has a "Print" button. The idea is that when the user clicks it, the contents of the iframe is printed. For some reason instead of the iframe...
2
by: Timo | last post by:
When content is transferred from a hidden IFRAME (which has fetched data from a database) to a DIV in the main document, how can a script determine that the DIV has been completely populated before...
3
by: Earl Teigrob | last post by:
Can a Modal Dialog Box do forms ASP.NET forms validation from within the Modal Box? I want to pop up a dialog box to the user and have it do its own post backs with validation checking and then...
6
by: Fred | last post by:
I have implemented a dialog box (an aspx page) using showModalDialog. Because the dialog needs to process postbacks, I have implemented it in a frameset. In the top of the framset page, I have...
2
by: sthrudel | last post by:
Hi! I'm working on a web application in Asp.net and what I would like to have is a cross borwser modal dialog which accepts user's input. I would like to catch what the user clicked on the...
3
by: nitinmukesh123 | last post by:
Hi I am facing a problem with setting the modal window title.. source of 1.html <html> <head> <script language="javascript"> function openNewWin() {...
4
by: jhalavirendra | last post by:
Hi All, I am using ASP.NET 2.0 and C#. I am opening a Modal Dialog Box from .aspx page. This dialgo box contains a grid and user can add new recod to this grid from here. When this dialgo...
7
by: Peter | last post by:
I have the following code which is executed from a modal web page - it works fine on most, but on some computers the Word loads into memory but never displays. This occurs with IE6 and IE7, but...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
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...
0
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...

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.