Re: HREF tag and JavaScript

by Thomas James Allen <tjallen(at)pipeline.com>

 Date:  Wed, 10 Nov 1999 21:27:49 -0500
 To:  Nik Robinson <Nikki.Lee.Robinson(at)brunel.ac.uk>
 Cc:  hwg-basics(at)hwg.org
  todo: View Thread, Original
At 09:51 AM 11/5/99 -0000, you wrote:
>I have a JavaScript to open a new window...
<snipped>
>I know you can do this using the following code, but I was sure there was a
>cleaner way with something like <.A HREF="#" onClick......> etc.
>
><a href="javascript:winOpen('http://mypage.com')";>Open Page</a>
>
>Thanks again,
>Nik Robinson
-----------------------

I suppose someone has already answered you, but if not, here goes:

The other way that you mention is like this:

<a href="#"
onClick="window.open('newWindowsURL.html','windowname','width=200,height=350')">
Click here</a>

Note: this should be all in one line. Be careful with various quote marks.
Note: there are no spaces between the elements of the third parameter
of the window.open (), and there are lots of settings available,
width,height,scrollbars,resizable,menubar,etc,etc,etc

The href="#" defaults to the top of the current page. If you are at midpage,
and want to stay there, you need a named anchor on the page at that point,
and then the href="#anchorname"

Hope this helps,
jimmy
---
Jimmy Allen (Thomas James Allen)
Business - Get Your Website Here
http://www.getyourwebsitehere.com
Personal - Eclecticity
http://www.getyourwebsitehere.com/personal

HTML: hwg-basics mailing list archives, maintained by Webmasters @ IWA