[Javascript] global variables in frames

Peter-Paul Koch gassinaumasis at hotmail.com
Wed Nov 27 07:46:10 CST 2002


>I have a window with 3 frames.
>I want to access a global variable "xyz"  from all the
>frame and I want to change the value from any frame.
>
>How do I define this variable?

Define it in the frameset page:

<script etc.>
var xyz = '123';
</script>

and from each frame call top.xyz:

alert(top.xyz) // gives '123'

--------------------------------------------------
ppk, freelance web developer
Interaction, copywriting, JavaScript, integration
http://www.xs4all.nl/~ppk/
Column "Keep it Simple": http://www.digital-web.com/columns/keepitsimple/
New: Interview by Carole Guevin:
http://netdiver.net/interviews/peterpaulkoch.php
--------------------------------------------------


_________________________________________________________________
Tired of spam? Get advanced junk mail protection with MSN 8. 
http://join.msn.com/?page=features/junkmail




More information about the Javascript mailing list