sharing script /w other frames

JavaScript and client side scripting.

Moderator: General Moderators

sharing script /w other frames

Postby Kyori » Mon Nov 25, 2002 6:43 am

I need to write new HTML on a frame. However everytime document.write is called from frame, the whole page reloads (not just that frame).

BTW, index.htm is just composed of text.

main.htm
Syntax: [ Download ] [ Hide ]
<script>

function d()

{

document.write("hello");

}

</script>





<frameset rows="80%,*" framespacing=0 border=0 frameborder=0>

 <frameset cols="30%,*" framespacing=0 border=0 frameborder=0>

    <frame src="index.htm" name="stat" noresize>

    <frameset rows="40%,*" framespacing=0 border=0 frameborder=0>

      <frame src="index.htm" name="action" noresize>

      <frame src="map.php" name="map" noresize>

    </frameset>

 </frameset>

 <frame src="index.htm" name="mesg" noresize>

</frameset>



snip from map.php
Syntax: [ Download ] [ Hide ]
echo "

<script>

parent.d();

</script>"
;



Also, how can I use variables from main.htm in the "action" frame?

thanks
Kyori
Forum Newbie
 
Posts: 23
Joined: Mon Oct 14, 2002 5:23 am

Postby volka » Tue Nov 26, 2002 12:13 am

hm hm hm...only guessing but you might pass a reference to the frame's document to the function.
Syntax: [ Download ] [ Hide ]
<script>
function d(oDoc)
{
  oDoc.write("hello");
}
</script>
---------------
<script>
parent.d(document);
</script>
User avatar
volka
DevNet Evangelist
 
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger


Return to Javascript

Who is online

Users browsing this forum: Bing [Bot] and 4 guests