SitePoint Sponsor

User Tag List

Results 1 to 10 of 10
  1. #1
    SitePoint Addict
    Join Date
    Sep 2000
    Posts
    230
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Netscape Query String Issues ??

    In javascript i'm trying to pass a querystring that looks like this:

    Code:
    window.document.location.href = "q" +question2+ ".asp?count=2&q1=" + myVal;
    This works fine in IE, but Netscape it times and won't to go the the next page (i.e. qX.asp?....)

    Any ideas?

  2. #2
    ********* obeah makeda's Avatar
    Join Date
    Jun 2001
    Location
    rollin' on dubs
    Posts
    492
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    what if you leave off the href and just try this:

    Code:
      window.document.location = "q" +question2+ ".asp?count=2&q1=" + myVal;
    Does that work? (I don't use netscape much, don't have it installed)

  3. #3
    SitePoint Addict
    Join Date
    Sep 2000
    Posts
    230
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    nope doesn't do anything...

    I've been trying to alert this:

    Code:
    x = "q" +question2+ ".asp?count=2&q1=" + myVal;
    alert(x);
    but that doesn't even work in netscape

    however I can alert this:
    Code:
    x = "q" +question2+ ".asp"
    alert(x);

  4. #4
    SitePoint Addict
    Join Date
    Sep 2000
    Posts
    230
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    anybody ever seen this?

    any ideas?

  5. #5
    SitePoint Enthusiast
    Join Date
    Jan 2002
    Posts
    48
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What is window.document.location, I guess IE lets this fly, but its really window.location thiers no document involed..

    When I tested it worked fine, but it should be:

    window.location.href

  6. #6
    JavaScript Guru (Big Ego) Arielladog's Avatar
    Join Date
    Jul 1999
    Location
    SC, USA
    Posts
    390
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    As Fly Swatter said,

    Use the window's location object, not the document's. Also, I've noticed sometimes that you need to have the page up on a server for query strings to work 100%.

    aDog

  7. #7
    Currently Occupied; Till Sunda Andrew-J2000's Avatar
    Join Date
    Aug 2001
    Location
    London
    Posts
    2,475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:

    <script language="javascript">

    question2 'Why do people still use netscape when its crap';
    myVal     'dunno';

    locate = eval("q" question2 ".asp?count=2&q1=" myVal);
    alert(locate);
    window.location locate;

    //could try this
    //window.location.replace = "";
    </script> 

  8. #8
    SitePoint Addict
    Join Date
    Sep 2000
    Posts
    230
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks, guys,
    I cleaned up the code (removed the document) and made sure all my variables were passing values, and now it's working.

    Thanks.

  9. #9
    Currently Occupied; Till Sunda Andrew-J2000's Avatar
    Join Date
    Aug 2001
    Location
    London
    Posts
    2,475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    so did the code above work in netscape as i neva use it?

  10. #10
    The doctor is in... silver trophy MarcusJT's Avatar
    Join Date
    Jan 2002
    Location
    London
    Posts
    3,509
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Although "window.location=newURL" is usually fine, it is actually bad practice to do so. You should indeed be setting the "window.location.href" property instead.


    M@rco


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
  •