General discussion

Locked

Java Script and HTML--global variable to

By excelquestion ·
I am trying to find out how to make a Javascript or HTML variable to many HTML pages. A JS function prompts the user for a file name, and then stores it in a local variable, path. I was now trying to make this string availiable to both the HTML and javascript sides on many HTML pages...can this be done, hopefully without using cookies :-) thanks a lot!

This conversation is currently closed to new comments.

2 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Java Script and HTML--global variable to

by keith.hall1 In reply to Java Script and HTML--glo ...

You could store the variable within a seperate frame on the screen. If you don't wish the user to see the frame, set the height to 0, hide the frame borders. If the frame is called topframe, and the variable strFilename , and you have a function to set this variable called
setfile(String theFile){
strFilename=theFile;
}
and function called
getfile(){
return strFilename;
}
You can call thse functions from another page on the other frame by using
parent.topframe.setfile("thename.txt")or
alert(parent.topframe.getfile());

Regards

Keith Hall

Collapse -

Java Script and HTML--global variable to

by excelquestion In reply to Java Script and HTML--glo ...

thanks a lot Keith, great idea! :-D

Back to Web Development Forum
2 total posts (Page 1 of 1)  

Related Discussions

Related Forums