Page 4 of 4 FirstFirst ... 234
Results 31 to 32 of 32

Thread: Implementation to send variables through the url (with javascript) like PHP $_GET.

  1. #31
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,878
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Because the URL may contain characters such as %2e, which should be unescape()ed back into their original unencoded forms (. in this case).
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  2. #32
    Join Date
    Dec 2004
    Location
    UK
    Posts
    2,358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Agrajag
    Can you please explain why ... you used this line:
    Code:
    return match ? unescape(match[1]) : null;
    while
    Code:
    return match[1];
    works fine?
    For what definition of "works"?

    Yes, if the regular expression is always matched (if the sought parameter is always present), then the exec method will always return an object reference. However, if a parameter is absent the return value will be null, and attempting to access a property of a null value will cause a run-time error.

    Mike

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
  •