Tech or Treat! Write an article about your scariest tech disaster to win gadgets!Learn more

x
?
Solved

Javascript stack implementation

Posted on 1997-11-10
2
Medium Priority
?
655 Views
Last Modified: 2012-08-13
  I know this is probably very simple but has anyone implemented a stack, with push and pop capabilities, using Javascript? I need an example to use to keep track of URLs visited on my site and allow a user to back out the way they came in. I know about the History.back and history.go functions but IE and Netscape implement them differently in pages utilizing frames.
0
Comment
Question by:gwolf111097
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 6

Accepted Solution

by:
tecbuilder earned 400 total points
ID: 1273328
If your web site is not all frames then you will have to resort to using cookies or opening a window and use the methodology described below.  Only problem is if the user closes the window.

If your web site is frames only then you can store where the user has been or is going in one of the frames that don't change.  To implement create a global array and counter variable in the non-changing frame.  Then when the user goes from one URL to another you call a function that increases the counter and then inserts the URL to where they are going into the array at the counter location.

function addURL(toURL) {
  cntURL = cntURL + 1
  arrayURL[cntURL] = toURL
}

To go back:

function gotoURL() {
  cntURL = cntURL - 1
  parent.yourframename.location = arrayURL[cntURL]
}

0
 

Author Comment

by:gwolf111097
ID: 1273329
While not having a pop function, this works for me. Thanks!

   
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

647 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question