SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Jan 2006
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Replace Function problems...

    Hi guys,

    hope somebody can help me out here...

    I have an ASP page written in Jscript which will pull a querystring and manipulate it using the replace function...

    the code is as follows :
    Code:
            var sContentRef = Request.Querystring("contentref");
    
            sContentRef = sContentRef.replace("-", " ");
    however I get the following error :

    Code:
    Microsoft JScript runtime  error '800a01b6'
    
    Object doesn't support this property or method
    Now if I change the code to not pull the querystring but simply have the value in the variable it works fine, what am I doing wrong?!

    Any help is much appreciated...
    WhichGame.net
    Xbox, Xbox 360, PS2, PS3 and PC video games news and reviews
    PSP Paradise
    PSP video game news and reviews

  2. #2
    SitePoint Zealot trekmp's Avatar
    Join Date
    Dec 2005
    Posts
    158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Not used Jscript but try

    Code:
    var sContentRef = new String(Request.Querystring("contentref"));
    Then you may need to use a regex for the replace

    Code:
    sContentRef = sContentRef.replace(/-/gi, " ");
    I think this is the correct format, not that well up with regex
    Why do we exist? What is our purpose?
    >H2O Developments
    >USS Endeavour
    >Hosted@Servage

  3. #3
    SitePoint Member
    Join Date
    Jan 2006
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    fantastic, works like a charm!

    many thanks
    WhichGame.net
    Xbox, Xbox 360, PS2, PS3 and PC video games news and reviews
    PSP Paradise
    PSP video game news and reviews


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
  •