Is this possible in a Client Side Language Like JS

Results 1 to 2 of 2

Thread: Is this possible in a Client Side Language Like JS

  1. #1
    Rob Guest

    Default Is this possible in a Client Side Language Like JS

    Is it possible in a client side language like javascript to do this:<BR>Have an array in a js file referenced in a framset page so all other pages can see it without overwriting the array each time they load. Then on each page the user goes to (on my intranet site/with no toolbar) it passes into the array the current file name. Then if they click my own back button it reads the array and goes to whichever page they were on last??? Some people are saying its possible others are saying I can only do it Server side. I am experiencing Read Memory Errors at the moment. Here is the code in my js file so far.<BR>var URLarray = new Array(10) //array of URLs the user has visited <BR>var nURLarray = new Array() //array of URLs not allowed to go back to<BR>var cntr = 1<BR><BR> function addURL(u){<BR> //adds the url of the page that the user was previously on to array<BR> <BR> URLarray[cntr] = u;<BR> alert("Array Part " + cntr + " is " + URLarray[cntr])<BR> cntr ++ <BR> }<BR><BR><BR> function LookAtArray(){<BR> <BR> var msg = ""; <BR> for( var i=0; i &#060; top.URLarray.length; i++ ) <BR> { <BR> msg += ("Part[" + i + "] is " + top.URLarray[i] + "
    "); <BR> } <BR> alert( msg ); <BR> <BR> }<BR>The addURL() function works and I can see by the alert boxes that each page I go to the array is incrementing. However when I call the LookAtArray() function it is bringing up "cannot read memory &00000" errors. Am I barking up the wrong tree? is there an easier way of doing this. Can anyone give me some code to accomplish it another way. The user might want to click back a few times so it needs to know what page it was on up to 10 clicks back.

  2. #2
    Join Date
    Dec 1969

    Default I think it should work...

    I think you just need more debugging.<BR><BR>You say you get errors in the LookAtArray function. Fine. So put in more debug code.<BR><BR>function LookAtArray(){<BR><BR>alert("In LookAtArray function.");<BR>alert("top.URLarray is " + top.URLarray );<BR>alert("Array length is " + top.URLarray.length );<BR><BR>var msg = ""; <BR>for( var i=0; i &#060; top.URLarray.length; i++ ) <BR>{ <BR>msg += ("Part[" + i + "] is " + top.URLarray[i] + "
    "); <BR>} <BR>alert( msg ); <BR><BR>}<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts