Click to See Complete Forum and Search --> : keeping selection in mind


slam
10-15-2003, 06:12 PM
in my webpage which contains 4 frames I use the "dialog" frame to let the viewer select the language which he/she wants to view.

<a href="french.html" target="comments"> <img src="bild/france.gif" width="33" height="20" border="0" alt=""/></a>

etc (similar statements for other languages)

the french text will be placed in the "comments" frame

---------------

the same "dialog" frame has a 'continue' button and I want to show the next information in the right language in that "comment" frame...

how can this be done ? (store the selection in a variable)

thanks

Khalid Ali
10-16-2003, 12:06 AM
does this coninue button takes the user to the next page?
if so then you may want to use cookie to store the language pref or you can append the pref to the URL of the next page and parse the url on the next page to get the pref.

If its the same page where you need to access it then a global JavaScript variable will be accessible from most of the page

slam
10-16-2003, 03:30 AM
thanks you for this quick reply.
Since its the same page I will be using (like to keep it a static webpage) I will need a global variable.
Don't like cookies because most people disable them anyway.

But, I've been learning HTML and JavaScript for a few weeks now, and cannot find how to declare and use a global variable ?

I would be glad if you could help me with this.

Thank you

lillu
10-16-2003, 03:45 AM
Just declare those variable right before any functions. You may even declare a local variable inside a function with the same name, it will not effect the value of the global variable.

<script language="JavaScript">
// declare global variable
var variable1;

// declare and initialise global variable
var variable2 = '2';

function myFunction() {