Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

A stack to be accessed by various pages

 
CD Phillips
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to implement a stack that allows HTML pages / Javascripts to push values onto and pop values from this common stack.

Any ideas would be very helpful.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is no way of maintaing or sharing data from page to page with JavaScript unless you resort to cookies, query strings, or hidden frames. Cookies and query strings can not hold objects and hidden frames can disrupt navigation....

The thing that JavaScript annoys developers is that objects are created and destroyed as the pages are rendered. Variables are reset and heads bang against walls.

What are you trying to do exactly? Are you just trying to keep from adding functions from page to page? Then you can use external JS files.

Eric
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65220
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is exactly what the concept of a session in server-side languages (such as JSP/Servlets) is for.

As Eric pointed out, this would be very difficult and hobbled using only client-side technologies.
 
CD Phillips
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your speedy reply Eric.

I am building a demo of a voice mail application interface. Each digit selection made by the user on numeric virtual telephone keypad takes him to a new page, the requested new menu, that also presents the user again with the keypad for further selections and so on. (Basically the user navigates using this simulated telephone keypad as he would a voice app using a real phone.)

Every time a new page loads, presenting new menu options, I would like to display, in a frame positioned besides the onscreen keypad on the desktop, menu tracking information to allow the user of the demo to visually see his history of activity.

Since the history object does not allow access to its location properties I am trying to use a stack to store each location (or just some string representation of it) in the stack. By doing so I can use the contents of the stack to create a call flow diagram, where each item in the stack would be a node (green box if you run the script below) representing previous user selections.

ps. By the way, I hope Shona said yes?





[made it formatted - Eric]
[ June 21, 2005: Message edited by: Eric Pascarello ]
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use a hidden frame to keep track of the changes. Bascially store the information into a array on that page and you would be able to use it.

I do not have time to look at your code right now to see what to change to get this to work exactly.

Eric
(She said yes - getting married Oct. 1st)
 
CD Phillips
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Many thanks, and all the very best for your wedding plans.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic