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