Click to See Complete Forum and Search --> : passing a window.open URL in IE


Wildcat
09-13-2003, 07:13 PM
I need to design part of my site to display in a pop-up window (a comic) because my site is in frames and I feel it would be nicer for the user to see the whole comic rather than having to scroll down because of my frames. Here's my script:



<script language="JavaScript"><!--

function seeComic(URL) {
comicWindow = window.open(URL, "Shooting Stars", "toolbar=no,width=600,height=600,status=no,scrollbars=yes,resize=no,menubar=no");
}

--></script>



And in the body,



<a href="#" onClick="javascript:seeComic('comic/page1.html');">1,</a>



This script works perfectly in NN and Opera. I had to make the href a # because IE kept going to a blank page with [object] in it when I just used window.open(). But IE gives me this error message when I try to pass the URL to the script:

Line 11
Char 2
Error: Invalid arguement

I can't see any flaws in the script (I found it in Web Design in a Nutshell, my class textbook), or any reason it shouldn't work. Is there a way to code around this without all a whole bunch of if statements to write something different just for IE?

Thanks.

requestcode
09-13-2003, 07:47 PM
I might be because you have a space in the window name "Shooting Stars". I don't believe you should. Try removing the space and see if that corrects the problem.

Also, your onClick does not require the word javascript. Just code it like this: onClick="seeComic('comic/page1.html');"

Charles
09-13-2003, 07:50 PM
There's a lot going on there but it all boils down to the fact that you need to make sure that your page works for those 13% of users that do not use JavaScript. For those happy folks we'll assume that you want the comic to appear in the top window.

<a href="comic/page1.html" onclick="window.open(this.href, 'child', 'height=600,width=600'); return false" target="_top">Comic 1</a>

Wildcat
09-13-2003, 07:56 PM
Yes, thanks. I should've considered a non-javascript option, although I would've put in a warning that javascript was required. Thanks to both of you. I think the space was the main problem, but I will certianly include the href for those without javascript.