View Single Post
Old 16-09-2003, 06:34   #1 (permalink)
dan
Iris Folder
 
dan's Avatar
 
Join Date: Apr 2003
Location: smokey
Posts: 2,650
Javascript frame targeting

Right - some simple Javascript here that I'm stumbling around all over

It's more complicated than this but the crux of what I'm doing is as follows.

I have an html page containing 2 frames. A & B
I need to extract a variable from a script within one frame using a script in the other.

Frame A Script...

<script type="text/javascript">
var test = "hello?";
</script>

Frame B Script...

<script type="text/javascript">
function targetTest {
alert(parent.A.test + "- yes I'm here");
}
</script>

I call targetTest() from an onClick event.

<a href="#" onClick="targetTest();"> CLICK TO TEST </a>


[edit] it would appear that the above code is in fact fine [/edit]



I've obviously got this wrong, doesn't work test is always undefined - help!

Never really sure where to post these, guess it should really be in the Programming section, move it if that's where it should live Been trying to find examples on Javascriptsource.com etc but to no avail, it's probably just too simple a problem...

Last edited by dan : 16-09-2003 at 07:09.
  Reply With Quote