SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    Dec 2003
    Location
    brazil
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    ??how to define a very large string var

    I need to pass a large string from PHP into Jscript var,
    but the following isn't accepted:

    text = 'a very large string for a text box which comes with line breaks
    an so takes many lines '

    this produces the (unterminated string constant)

    any idea?

  2. #2
    "Of" != "Have" bronze trophy Jeff Lange's Avatar
    Join Date
    Jan 2003
    Location
    Calgary, Canada
    Posts
    2,063
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    that's because in javascript, string declarations cannot span multiple lines.

    You'll need to replace all the linebreaks in PHP with \n
    Who walks the stairs without a care
    It shoots so high in the sky.
    Bounce up and down just like a clown.
    Everyone knows its Slinky.


Bookmarks

Posting Permissions

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