Pass variable window pop up javascript

S

shookim

I've been looking all day for some code examples of how to pass a
variable throught a javascript pop up window. There's nothing decent
out there on the web...so after hours and hours of searching, I've
finally figured out how to do complete the code for passing a variable
to a window pop up and back.

(Main window)

create a window.open() function in your event, mine happens to be a
"Find" button.

<img src="images/Find1.gif" height=21
onclick="Javascript:window.open('Test6.asp?txtManagerName='+document.getElementById('txtManagers').value,
'wroxwindow', 'height=200, width=300, top=250, left=350, resizable=yes,
scrollable=yes, toolbar=no');">

the major problem I had was the exact syntax for passing the variable:

Test6.asp?txtManagerName='+document.getElementById('txtManagers').value

(you can name the value, doesn't have to be:
document.getElementById('txtManagers').value
could be...txtManagers, or whatever your variable being passed is.



(Pop up window)

Use a querystring command (vbscript)

<%
test = Request.QueryString("txtManagerName")
Response.Write "test = " & test
%>

That's it...

sk
 

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

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top