PDA

View Full Version : passing variables to JS window.open


ssoltz
01-18-2003, 09:12 PM
Hi All,

My problem of the day seems pretty simple. I have a Flash MX variable that holds a URL. I want to pass that to a JavaScript NewWindow=window.open which is triggered inside an on (release) event handler. Seems simple enough.

The problem is, no matter what I try, it tries to open up the variable name, not the URL itself (curURL). I've tried enclosing it in brackets ([curURL]) and have tried Abelius' method here (which declares a function inside the HTML for the main .swf):

http://www.actionscripts.org/forums/showthread.php3?s=&threadid=14077

That didn't change things at all. I'm perplexed. If anyone knows the solution to this, please chime in.

Thanks in advance!

jimburton
01-18-2003, 10:42 PM
if you go getURL("javascript:void(0);window.open(foo);"); it will try to literally open foo, so you need to put it like this:
getURL("javascript:void(0);window.open("+foo+");");

ssoltz
01-18-2003, 10:58 PM
yes...thank you...I just figured this somewhat obvious thing out...brain lock!!

Thanks for the reply!

Daiko
09-21-2004, 07:54 PM
Thanks for the tip. This all works fine, but I have one problem: The script also changes the original browserwindow and includes the script reference in the adress field and leaving the following in the main window:

[object]

What's wrong?

The code looks like this:

getURL("javascript:window.open('"+Path+"', 'Cart','toolbar=no,location=no,directories=no,stat us=yes,menubar=no,scrollbars=yes,resizable=yes,wid th=810,height=600,left=5,top=5')")

Daiko

tg
09-21-2004, 10:18 PM
try:

getURL("javascript:window.open('"+Path+"', 'Cart','toolbar=no,location=no,directories=no,stat us=yes,menubar=no,scrollbars=yes,resizable=yes,wid th=810,height=600,left=5,top=5');void(0);")