Link to home
Start Free TrialLog in
Avatar of mlaman
mlaman

asked on

Accessing innerHTML in another frame with Firefox

I have a main .htm page with three frames:

(1)  frameA (navigation bar)
(2)  frameB (site locator...this is a dynamic hyperlink bar that displays current location)
(3)  frameC (site contents)

As a new page is loaded in frameC, I would like for it to report its location to frameB so frameB can show the updated link information.

:: snip from frameB ::
<tr>
  <td height="15" width="90">you are here: </td>
  <td><div id="siteLoc"> </div></td>
</tr>

:: snip from frameC ::
<script language="JavaScript">

// load up the navigation in frameB
var l = '<a href="home.htm" target="frameC">home</a>';
parent.frames('frameB').document.getElementById('siteLoc').innerHTML = l;

</script>


Works fine in IE, but does not render anything in Firefox.  Any suggestions?
Avatar of archrajan
archrajan

parent.frames('frameB').document.getElementById('siteLoc').innerHTML = l;
shud be
parent.frames['frameB'].document.getElementById('siteLoc').innerHTML = l;
Avatar of mlaman

ASKER

Jeeze, that was fast...

Tried the following code:
<<parent.frames['frameB'].document.getElementById('siteLoc').innerHTML = l;>>

Does not work in Firefox and IE stops working.

Any other suggestions?
It works for me unless the name of ur frameB is frameB (case sensitive)
it works in both IE and FIREFOX for me..
See here:
http://www.archanapatchirajan.com/parentframe.html
just click the button in the right hand side frame
Avatar of mlaman

ASKER

Ok...your page is working fine here, too.  Let me study again what is not working.  The situations are not exactly similiar...

You have a function defined and pressing the button is causing frameB to be loaded...maybe try having the code inline not executed by pressing a button, but automatically when the page loads?

while (!parent.frames['frameB']){}
parent.frames['frameB'].document.getElementById('siteLoc').innerHTML = l;
Avatar of mlaman

ASKER

archarajan,

I copied out your code and made it function like my site does here.  And it works great.

Now I am really confused.  Let me study a bit and see where I have a type-o?

Can u post ur code?
Avatar of mlaman

ASKER

Ok my dns servers are currently under maintenance, but I will post code here (minimized).  I can't seem to find the type-o!

I will send in three posts...

Post (1)  index.htm (frameset)
Post (2)  siteloc.htm (belongs in frameB and is the site locator)
Post (3)  home.htm (sample home page)

I am leaving out the source for frameA, it is just a navigation bar...
Avatar of mlaman

ASKER

<html>

<head>

<title>Company Name</title>
</head>

<FRAMESET rows="126,16,*" border="0">
<FRAME SRC="navigate.htm" NAME="frameA" marginwidth="0" marginheight="0" scrolling="no" noresize>
<FRAME SRC="siteloc.htm" NAME="frameb" marginwidth="0" marginheight="0" scrolling="no" noresize>
<FRAME SRC="home.htm" NAME="frameC" marginwidth="0" marginheight="0" scrolling="auto">
</FRAMESET>


</html>
Avatar of mlaman

ASKER

<html>
<head>
<title>Company Name - site locator</title>
<meta http-equiv="Content-Type" content="text/html;">

<style type="text/css">

body  {
      font-family: Verdana, Lucida, Helvetica, Arial, sans-serif;
      font-size: 8pt;
      color: black;
}

A  {
      text-decoration: underline;
      color: darkblue;
}

A:hover {
      text-decoration: underline;
      color: #FFA500;
}


TD {
      font-family: Verdana, Lucida, Helvetica, Arial, sans-serif;
      font-size: 8pt;
      color: black;
      text-align: left;
}

</style>


</head>
<body background="sitelocbg.gif" topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0">
<div align="center">
<table width="800" border="0" bgcolor="#bcd4f6" cellpadding="0" cellspacing="0">
 <tr>
  <td height="15" width="90">you are here: </td>
  <td><div id="siteLoct"></div></td>
 </tr>
</table>


</div>
</body>
</html>
Avatar of mlaman

ASKER

<html>
<head>
<title>Company Name - home</title>
<meta http-equiv="Content-Type" content="text/html;">
<link rel="STYLESHEET" type="text/css" href="wwwstyle.css">

<script>

var l = '<a href="home.htm" target="frameC">home</a>';
parent.frames['frameB'].document.getElementById('siteLoct').innerHTML = l;

</SCRIPT>

</head>

<body topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0">

<div align="center">
<table width="800" border="0">
 <tr>
  <td><br><br>Home page text removed to save posting room!<br><br>
</td>
 </tr>
</table>
<br><br>
<table border="0" width="800" cellpadding="0" cellspacing="0">
 <tr>
  <td colspan="2"><hr size="1" color="white"></td>
 </tr>
 <tr>
  <td width="15"><img src="minicologo.gif"></td>
  <td><div id="copy1" class="copy">Internet site &copy;2005 Company</div></td>
 </tr>
</table>

</div>

</body>
</html>
ASKER CERTIFIED SOLUTION
Avatar of archrajan
archrajan

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mlaman

ASKER

Works like a champ in both IE and Firefox.  Jeeze this has been buggin me in another page, too.

it mUts bea mye expret speellnig texniqqe...do they have a section here at experts exchange for spelling bees?

Thanks a million for helping an idiot out!
Not a problem.. it always happens to all of us...
thanks for the points and the grade