Javascript help with iframes

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

I normally manage to avoid this stuff but I need to have a button that  
toggles between old pages ending .htm and new ones ending .html

I thought it would be fairly easy but I have hit a snag.

window.frames[0].location = "index.htm"  works OK

alert(window.frames[0].location)  fails mysteriously

I have also tried qualifying it .href etc no joy :(

The actual code is

<input onclick="alert(self.location);
        value="toggle" type="button">

The output is:
  fully qualified filename for the HTML file
  frames[0] changes to show contents of index.htm (as expected)
  crashes out here

In short I want a foolproof way of obtaining the URL name of the page  
being displayed in a particular IFRAME so that I can adjust it.
(adding or removing a trailing "L" according to taste)

I happen to know in this case that it will be in frames[0].

I have never encountered a situation where you can successfully assign a  
string to a variable/property and then not be able to look at it again.

Can anyone see what I am doing wrong? I can't!
Thanks for any enlightenment.

Martin Brown

Site Timeline