• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 630
  • Last Modified:

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?
0
mlaman
Asked:
mlaman
  • 8
  • 6
1 Solution
 
archrajanCommented:
parent.frames('frameB').document.getElementById('siteLoc').innerHTML = l;
shud be
parent.frames['frameB'].document.getElementById('siteLoc').innerHTML = l;
0
 
mlamanAuthor Commented:
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?
0
 
archrajanCommented:
It works for me unless the name of ur frameB is frameB (case sensitive)
it works in both IE and FIREFOX for me..
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
archrajanCommented:
See here:
http://www.archanapatchirajan.com/parentframe.html
just click the button in the right hand side frame
0
 
mlamanAuthor Commented:
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?

0
 
GwynforWebCommented:
while (!parent.frames['frameB']){}
parent.frames['frameB'].document.getElementById('siteLoc').innerHTML = l;
0
 
mlamanAuthor Commented:
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?

0
 
archrajanCommented:
Can u post ur code?
0
 
mlamanAuthor Commented:
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...
0
 
mlamanAuthor Commented:
<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>
0
 
mlamanAuthor Commented:
<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>
0
 
mlamanAuthor Commented:
<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>
0
 
archrajanCommented:
Here is the typo:
u have the name of frameb as  "frameb"
But in ur script u r calling it as "frameB"
It shud be similar

Also i suggest u to put the following part of the code just before the closing body tag </body>
 <script>

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

</SCRIPT>

0
 
mlamanAuthor Commented:
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!
0
 
archrajanCommented:
Not a problem.. it always happens to all of us...
thanks for the points and the grade
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 8
  • 6
Tackle projects and never again get stuck behind a technical roadblock.
Join Now