|
<!-- MultiInfos document.cookie="SplitString=User:Vittorio O./age:53/tel:0881 631796"; document.write(document.cookie/* Return value in next line comment */') // --> </Script> Comments : document.write(information.age) ... undefined at this point during the interpreter 1st run down var information is undefined , but declared . In the next line of code readTheCookie(information) calls with its information argument, [ already declared as an empty variable : var information = new Array(); ] readTheCookie(the_info) and from here starts the second run down of the interpreter, the elaborated values will refill the arrays when the interpreter goes through them and all desired values can be retrieved from : var information = new Array(); ... with the following syntax ( pink color code at right side cell) : ... >>>> In InfoData.split("/"); the string of values is divided in a 3 elements array (the array length is the elements'number ) and therefore taking off 2 slashes , an array of 3 elements is generated and the values are returned, at this point, as InfoDataSplit[i] If we set for example : alert(InfoDataSplit[1]) we get : age:53 |
document.write(information.age) // Returns : 53* document.write(information['tel']) // Returns : tel:0881 631796* //--> </Script> |