<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
I can clearly see an error in firebug.<br>
It says "parent.imapframe has no properties".<br>
And that is true. The button is running in the same document as the
iframe. <br>
Thus the documents parent is the window, and it has no iframes.<br>
<br>
You should not rely on getting and entry by using its ID as the
variable name, as that is not W3C compliant.<br>
You should use document.getElementById() instead.<br>
<br>
There exists functions to get the correct frame, use "GetMapFrame()".<br>
I have fixed the code in your example.<br>
<br>
To examine what happens, try the following:<br>
1. Start the page in firefox<br>
2. Activate firebug<br>
3. Select the "Script" tab<br>
4. Select the page in the dropdown next to the "inspect" button
(topmost)<br>
5. Click next to the number 15 on the right (the line: var iframe =
document.getElementById('imapframe');)<br>
6. Click the "Refresh" button in the page.<br>
7. Observe the line gets highlighted in firebug<br>
8. On the pane to the right, try to click on "New watch expression..."<br>
9. Try to enter the following (press enter after each): parent, window,
document.getElementById('imapframe')<br>
10. Examine their properties by clicking the + signs below<br>
<br>
You can step to the next line by pressing F10.<br>
On line 23, try to press F11 to step into the function.<br>
Press F8 to resume the javascript.<br>
<br>
This is the HTML I used:<br>
<tt><br>
&lt;html&gt;<br>
&lt;head&gt;<br>
&lt;/head&gt;<br>
&lt;body&gt;<br>
<br>
&lt;iframe id="imapframe" frameborder="0" height="600" scrolling="no"<br>
width="800"
src="/mapguide/mapviewernet/ajaxviewer.aspx?WEBLAYOUT=Library://Samples/Sheboygan/Layouts/SheboyganAsp.WebLayout&amp;USERNAME=Anonymous&amp;PASSWORD="&gt;&lt;/iframe&gt;<br>
<br>
&lt;input type="button" value="refresh" onclick="test()" /&gt;<br>
<br>
&lt;script type="text/javascript"&gt;<br>
function test()<br>
{<br>
&nbsp;&nbsp;&nbsp; //Get the iframe<br>
&nbsp;&nbsp;&nbsp; var iframe = document.getElementById('imapframe'); //Set breakpoint
here<br>
&nbsp;&nbsp;&nbsp; //var iframe = imapframe; &lt;-- Non-standard compliant way, but
usually works<br>
<br>
&nbsp;&nbsp;&nbsp; //Some browsers return the &lt;iframe&gt; tag, others return the
contents, this evens it out<br>
&nbsp;&nbsp;&nbsp; if (iframe.contentWindow)<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; iframe = iframe.contentWindow;<br>
<br>
&nbsp;&nbsp;&nbsp; //Use the utility function to get the map frame<br>
&nbsp;&nbsp;&nbsp; iframe.GetMapFrame().Refresh(); //Try F11 here<br>
<br>
&nbsp;&nbsp;&nbsp; //The original code<br>
&nbsp;&nbsp;&nbsp; //parent.imapframe.mapFrame.Refresh();<br>
<br>
&nbsp;&nbsp;&nbsp; //Alternative, depends on the internal layout of the viewer<br>
&nbsp;&nbsp;&nbsp; iframe.mapFrame.Refresh();<br>
}<br>
&lt;/script&gt;<br>
&lt;/body&gt;<br>
&lt;/html&gt;</tt><br>
<br>
<pre class="moz-signature" cols="72">Regards, Kenneth Skovhede, GEOGRAF A/S
</pre>
<br>
<br>
A H skrev:
<blockquote cite="mid:17746775.post@talk.nabble.com" type="cite">
  <pre wrap="">well there's no error, so firebug didn't detect anything.


you can try on this,

this is the iframe,

&lt;iframe id="imapframe" frameborder="0" height="600" scrolling="no"
width="800" src="/mapguide/mapviewernet/ajaxviewer.aspx?SESSION=&lt;%=
get_session() %&gt;&amp;WEBLAYOUT=&lt;%= get_layout() %&gt;"&gt;&lt;/iframe&gt;


and a button,

&lt;input type="button" value="refresh" onclick="test()" /&gt;


and the refresh command,

&lt;script type="text/javascript"&gt;
    function test()
    {
        parent.imapframe.mapFrame.Refresh();
    }
&lt;/script&gt;


i've been googling for some time and still haven't find a solution to make
this work in Firefox.




Kenneth Skovhede, GEOGRAF A/S wrote:
  </pre>
  <blockquote type="cite">
    <pre wrap="">If you install firebug, you can inspect the code, and examine the 
objects you are calling:
<a class="moz-txt-link-freetext" href="http://www.getfirebug.com/">http://www.getfirebug.com/</a>

Next step would be to look at "MapGuide Developers Guide" page 19:
<a class="moz-txt-link-freetext" href="http://mapguide.osgeo.org/2.0/documentation.html">http://mapguide.osgeo.org/2.0/documentation.html</a>

You can see how the viewer frames are laid out, and see what 
"parent.parent" points to.
Page 18 describes what the frames are for and page 20-25 describe 
concrete cases.

Regards, Kenneth Skovhede, GEOGRAF A/S



A H skrev:
    </pre>
    <blockquote type="cite">
      <pre wrap="">sadly this doesn't work in Firefox. have anyone done this in Firefox?



uXuf wrote:
  
      </pre>
      <blockquote type="cite">
        <pre wrap="">Okay thanks. parent.viewerFrame.mapFrame works like a charm!

uXuf


Ivan Milicevic-3 wrote:
    
        </pre>
        <blockquote type="cite">
          <pre wrap="">try parent.viewerFrame.mapFrame.Refresh(); od
window.frames.mapFrame.Refresh();

________________________________

From: <a class="moz-txt-link-abbreviated" href="mailto:mapguide-users-bounces@lists.osgeo.org">mapguide-users-bounces@lists.osgeo.org</a> on behalf of uXuf
Sent: uto 8.1.2008 22:43
To: <a class="moz-txt-link-abbreviated" href="mailto:mapguide-users@lists.osgeo.org">mapguide-users@lists.osgeo.org</a>
Subject: [mapguide-users] Calling viewer api functions from the main
page


Hi all, I am trying to access the Viewer API functions from the main
page
of my application, i.e. the page that has the WebLayout embedded (or
the
iframe). I cannot seem to grab the exact frame from which these
functions
would be accessible. I tried using
document.getElementById("viewerFrame").GetMapFrame() (viewerFrame is
the
name of the iframe) putting it in the onload function of the iframe but
it returns "Object doesn't support this property or method". Can anyone
help me in this regard? Thanks! uXuf 

________________________________

View this message in context: Calling viewer api functions from the
main
page
<a class="moz-txt-link-rfc2396E" href="http://www.nabble.com/Calling-viewer-api-functions-from-the-main-page-tp14699670s16610p14699670.html">&lt;http://www.nabble.com/Calling-viewer-api-functions-from-the-main-page-tp14699670s16610p14699670.html&gt;</a> 
Sent from the MapGuide Users mailing list archive
<a class="moz-txt-link-rfc2396E" href="http://www.nabble.com/MapGuide-Users-f14845.html">&lt;http://www.nabble.com/MapGuide-Users-f14845.html&gt;</a>  at Nabble.com.


 
_______________________________________________
mapguide-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:mapguide-users@lists.osgeo.org">mapguide-users@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="http://lists.osgeo.org/mailman/listinfo/mapguide-users">http://lists.osgeo.org/mailman/listinfo/mapguide-users</a>


      
          </pre>
        </blockquote>
        <pre wrap="">    
        </pre>
      </blockquote>
      <pre wrap="">  
      </pre>
    </blockquote>
    <pre wrap="">_______________________________________________
mapguide-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:mapguide-users@lists.osgeo.org">mapguide-users@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="http://lists.osgeo.org/mailman/listinfo/mapguide-users">http://lists.osgeo.org/mailman/listinfo/mapguide-users</a>


    </pre>
  </blockquote>
  <pre wrap=""><!---->
  </pre>
</blockquote>
</body>
</html>