|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today! |
|
#1
|
|||
|
|||
|
window.open problem
Hey guys i encountered a problem recently....I am trying to creat a link to a window where the user can write down his name email and message and send it to a cgi script i installed in netfirms.com.....anyways everything is fine except from <A tag when its click the window pops but the window where its clicked from the whole window clears and this is shown '[object]'....what am i doing wrong......this is the code for the <A> tag im using.
Code:
<a href="javascript:window.open('http://mdomain.netfirms.com/mailadmin.htm','newwindow','width=400','height=350 ')";>Open window</a>
Last edited by stumpy : February 8th, 2004 at 06:58 AM. Reason: Please only show necessary code, and use the [code] tags. |
|
#2
|
||||
|
||||
|
The window.open method only takes 3 parameters - filename, window name and features. You have your features split up - width and height need to be within the single quotes together, not separately.
|
|
#3
|
|||
|
|||
|
Try using:
href="javascript:var win=open('http.... Hit me back if it works. That should do it double dog! -Meezee Last edited by meezee : February 9th, 2004 at 01:49 PM. Reason: want to tell him to hit me back if it worked... |
|
#4
|
||||
|
||||
|
Actually meezee, you should always use the correct DOM referecing, so when calling the 'open' method, you should preface that with 'window' - and there is no need to return the value.
|
|
#5
|
|||
|
|||
|
Thanks guys but i solved my problem....it seems that rather than adding the script in the <a> tag it works when I call a function from the <A> tag...so i just defined a function in the header and called it from <A> works fine...pretty weird ay..the functions got the same script its just returning...
|
|
#6
|
||||
|
||||
|
Check your window.open call - did u fix the parameters problem? It works either way, but I bet you've fixed the bug I pointed out first up.
|
|
#7
|
||||
|
||||
|
Quote:
|
|
#8
|
|||
|
|||
|
My question deals with the window.open method but what I am trying to do is dynamically size the height of the new window by using a variable. At first I tried using some asp code to run through my database and count the items for that day then multiply that times 100 and assign it to an Application variable. I couldn't seem to pass the value of that variable to the javascript so I've tried using if statements right in the script which is working fine. The problem is when I call the window.open code and try to pass the variable to it it's not recognizing it. Here is an example of the code:
Code:
function fwLoadMenus() {
dayName = new Array ("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
now = new Date
var winsize = 0
if (dayName[now.getDay()] == "Monday")
winsize = 600;
if (dayName[now.getDay()] == "Tuesday")
winsize = 400;
if (dayName[now.getDay()] == "Wednesday")
winsize = 550;
if (dayName[now.getDay()] == "Thursday")
winsize = 450;
if (dayName[now.getDay()] == "Friday")
winsize = 350;
if (dayName[now.getDay()] == "Saturday")
winsize = 250;
fw_menu_3.addMenuItem("TODAYS CLASSES", "window.open('events.asp', 'Classes', 'toolbar=no, status=no, width=320, height=winsize');");
I've only included the parts of the code that are affected but it's taken from my dropdown menu script. When I hard code the height it works fine. I've tried adding different brackets around it, different quote configurations, you name it. I even tried calling an include file and using the asp variable directly: height=<%Application("winsize")%> or height=<!-- #include file=getheight.asp--> Any suggestions would be greatly appreciated. |
|
#9
|
||||
|
||||
|
"winsize" is a variable, not a constant, therefore it needs to be seperated from the window.open statement. Like this:
Code:
fw_menu_3.addMenuItem("TODAYS CLASSES", "window.open('events.asp', 'Classes', 'toolbar=no, status=no, width=320, height=" + winsize + ");");
|
|
#10
|
|||
|
|||
|
Thanks so much for the help. It was driving me crazy. I couldn't understand why I was able to pop an alert(winsize); in my code and see that the variable contained a value but it wasn't being seen by the other code.
|
![]() |
| Viewing: Dev Articles Community Forums > Programming > JavaScript Development > window.open problem |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|