Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing parameter to new window

Status
Not open for further replies.

rhowes

IS-IT--Management
Joined
Jun 6, 2001
Messages
140
Location
ZA
Hi

I am opening a new window with:

var x = window.open("message.htm",....

How can I pass parameters? Can I use:

var x = window.open("message.htm?parm1=1",....

If so, how do I read the parameter. If not is there a way to pass parameters?

Thanks.
Cheers

Richard
 
hi rhowes,
Read this thread215-212973, I posted solution for 1 parameter there.

If you have more than 1 parameter the best thing will probably be to use split() function applied to URL string:

params = document.location.search.split('&')

This will create an array params[] where each item contains paramN=valueN substring.

good luck
 
Hi Starway,

Thanks, problem solved.

By the way, do you know how I can pass a string with spaces? When I try I get:

hello%20there

I know it is translating space to acsii equivalent. Is there a conversion function perhaps?

Thanks again.
Cheers,

Richard
 
I'm sure that there are tons of such scrits over the net, but I can't point you on anything particular. I always solve such issues myself, but I have no anything ready for this very case now.

You can use substring() method in a loop to find and extract %20 and then change it to whitespace, or probably using that split() function I told you about for the same purpose.

good luck
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top