General discussion

  • Creator
    Topic
  • #2083827

    Java Script and HTML–global variable to

    Locked

    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!

All Comments

  • Author
    Replies
    • #3780335

      Java Script and HTML–global variable to

      by keith.hall1 ·

      In reply to Java Script and HTML–global variable to

      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

Viewing 0 reply threads