Welcome to WebmasterWorld Guest from

Forum Moderators: incrediBILL

Message Too Old, No Replies

Using onClick to load new page NS + IE


neil laurance

1:21 pm on Jul 26, 2001 (gmt 0)

Hi Folks,

I am currently working on making legacy Javascript code written for IE work also on Netscape (v6)

Most of the code seems fine, as the amount of DHTML is minimal. However, the following code snippet works with IE and not NS:

<input type="button" value="Log on" onClick="open('../cgi/mycgi.pl?VAL1=xxx&VAL2=yyy', '_top', 'menubar,toolbar,location,scrollbars,resizable,status')">

However, replacing this with the following code works fine with both browsers:

<input type="button" value="Log on" onClick="location='../cgi/mycgi.pl?VAL1=xxx&VAL2=yyy'">

My question is: is there anything obviuosly wrong with the first method, or is this something quirky as to how Netscape deals with 'open'

Thanks for any insight. Cheers, Neil


3:21 pm on Jul 26, 2001 (gmt 0)

10+ Year Member

Normally you should explicitly provide the window object when in an event handler. I'm not sure if this applies to inline handlers, but its worth a try.

<input type="button" value="Log on" onClick="window.open(...)">


5:30 pm on Jul 26, 2001 (gmt 0)

WebmasterWorld Senior Member tedster is a WebmasterWorld Top Contributor of All Time 10+ Year Member

I think you're right, Mike. Without the "window", Netscape assumes this is a document.open(), but the arguments in this particular code are for a window.open()

I didn't realize that IE would assume "window". That's not standard js functioning, at least according to my references.


7:12 pm on Jul 26, 2001 (gmt 0)

10+ Year Member

Yep, I think you're right tedster. I also didn't realize that IE would assume the window object in this case.

Hi neil_laurance, did that work?

neil laurance

9:40 am on Jul 27, 2001 (gmt 0)

Yep. Putting window.open worked for NS and IE. Thanks for the advice. Cheers, Neil

Featured Threads

Hot Threads This Week

Hot Threads This Month