Problem creating query string

C

csgraham74

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
 
X

Xandax

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,021
Latest member
AkilahJaim

Latest Threads

Top