Cookies, Javascript and Split

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Aaron

    Cookies, Javascript and Split

    Data I'm saving to a Cookie looks like this: "A,B,C^1,2, 3" I need
    everything to the left of the "^" to go in one input box, and
    everything to the right in another input box when I load the Cookies
    into my page. Any suggestions using Javascript? I think I can use
    "split" somehow, but not sure exactly how to proceed. Thanks for any
    help...
  • Mick White

    #2
    Re: Cookies, Javascript and Split

    Aaron wrote:
    [color=blue]
    > Data I'm saving to a Cookie looks like this: "A,B,C^1,2, 3" I need
    > everything to the left of the "^" to go in one input box, and
    > everything to the right in another input box when I load the Cookies
    > into my page. Any suggestions using Javascript? I think I can use
    > "split" somehow, but not sure exactly how to proceed. Thanks for any
    > help...[/color]

    var theCookie="A,B, C^1,2,3".split( "^")

    var leftSide=theCoo kie[0]//"A,B,C"
    var rightSide=theCo okie[1] //"1,2,3"

    Mick

    Comment

    Working...