469,352 Members | 1,656 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,352 developers. It's quick & easy.

Problem creating query string

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.va lue=='3'))
{
window.open('frm_PreviousAddress.aspx?PreviousSurn ame='+
document.getElementById('txt_PreviousSurname').val ue +
'&PreviousHouseName='+
document.getElementById('txt_PreviousHouseName').v alue +
'&PreviousHouseNumber='+
document.getElementById('txt_PreviousHouseNumber') .value +
'&PreviousStreetName='+
document.getElementById('txt_PreviousStreetName'). value +
'&PreviousTownLand='+
document.getElementById('txt_PreviousTownland').va lue +
'&PreviousTown='+ document.getElementById('txt_PreviousPostTown').va lue
+ '&PreviousPostCode='+
document.getElementByID'txt_PreviousPostcode').val ue ,'', 'width=600',
'height=400', 'top=100', 'left=200', 'menubar=no',
'resizable=no');
}
}

Regards

CG

Aug 11 '05 #1
1 1269
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.

Aug 11 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Peter Bailey | last post: by
3 posts views Thread by dskillingstad | last post: by
4 posts views Thread by DeanL | last post: by
5 posts views Thread by Usman Jamil | last post: by
reply views Thread by zhoujie | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.