Problem creating query string

Discussion in 'Javascript' started by csgraham74@hotmail.com, Aug 11, 2005.

  1. Guest

    Hi guys,

    im attempting to build a querystring to use in a window.open to display
    a popup box.

    Unfortunately im quite new to javascript and find it quite difficult to
    get this functioning correctly.

    Would someone please have a look and point out any of my glaring
    mistakes. im a bit stuck.

    Thanks in advance

    function PrevAddress()
    {
    var txtAD;
    txtAd = document.getElementById('txt_TimeAtAddress');
    if ((txtAd.value=='1')||(txtAd.value=='2')||(txtAd.value=='3'))
    {
    window.open('frm_PreviousAddress.aspx?PreviousSurname='+
    document.getElementById('txt_PreviousSurname').value +
    '&PreviousHouseName='+
    document.getElementById('txt_PreviousHouseName').value +
    '&PreviousHouseNumber='+
    document.getElementById('txt_PreviousHouseNumber').value +
    '&PreviousStreetName='+
    document.getElementById('txt_PreviousStreetName').value +
    '&PreviousTownLand='+
    document.getElementById('txt_PreviousTownland').value +
    '&PreviousTown='+ document.getElementById('txt_PreviousPostTown').value
    + '&PreviousPostCode='+
    document.getElementByID'txt_PreviousPostcode').value ,'', 'width=600',
    'height=400', 'top=100', 'left=200', 'menubar=no',
    'resizable=no');
    }
    }



    Regards

    CG
    , Aug 11, 2005
    #1
    1. Advertising

  2. Xandax Guest

    Firstly, just a little tip.
    It is much easier to find issues with such strings, if you use a
    variable to hold the string while building it, and then add the
    variable as an url-parameter into your window.open function :)
    This would also mean you could alert the string and see how it looks
    easily.

    However - as for your question, then I think the problem is infact with
    the latter part of your parameter list in your window.open call:
    'width=600','height=400', 'top=100', 'left=200',
    'menubar=no','resizable=no'

    This should infact be:
    'width=600,height=400,top=100, left=200,menubar=no,resizable=no'
    That is a string of parameters seperated by commas, not a comma
    seperated list of parameters.
    Could be there your issue is burried and not with the actual url, which
    to me looks allright.

    Hope this helps.
    Xandax, Aug 11, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Learner
    Replies:
    1
    Views:
    983
    Marina Levit [MVP]
    Jan 30, 2006
  2. RiGGa
    Replies:
    3
    Views:
    309
    Tristan Seligmann
    Jun 27, 2004
  3. =?Utf-8?B?SnVsaWEgQg==?=

    Date string problem in query string when posting back

    =?Utf-8?B?SnVsaWEgQg==?=, Aug 29, 2007, in forum: ASP .Net
    Replies:
    5
    Views:
    563
    =?Utf-8?B?SnVsaWEgQg==?=
    Aug 29, 2007
  4. roadrunner
    Replies:
    1
    Views:
    233
    Gunnar Hjalmarsson
    Feb 8, 2006
  5. nick
    Replies:
    1
    Views:
    450
    David Mark
    Feb 13, 2011
Loading...

Share This Page