PDA

View Full Version : How do I Open A new web page window using a picture (in lieu of a 'button")


JohnCampbell
02-16-2004, 12:57 AM
I'm trying to open a new window when a picture is clicked.
Examples I've seen have used code starting w/ <form> input="button" onclick="window.open=('abc.htm')" this creates a button that when clicked opens a new page to the desired page. I'd like to use a gif/jpeg picture and when clicked it opens a new window and the desired web page.

My current code is below. Thanking you in advance for your help.

john Campbell


Click <a href="wreath.htm"> <onclick="window.open=('wreath.htm')"><img border="3" src="Eyes1.gif" width="42" height="44"></a>&nbsp;</font>
<font color="#00FFFF" size="6">&nbsp;</font><font size="6" color="#800080">Here</font>

glenngv
02-16-2004, 02:16 AM
You can simply specify the target to open the page in a new window.

<a href="wreath.htm" target="_blank"><img border="3" src="Eyes1.gif" width="42" height="44"></a>

But if you want to open a customized window with specific size, no address bar, menubars, etc...you can use window.open

function openPopup(url, target){
var w = window.open(url, target, 'width=800,height=600');
w.focus();
return false;
}
...
<a href="wreath.htm" target="_blank" onclick="return openPopup(this.href, this.target)">
<img border="3" src="Eyes1.gif" width="42" height="44"></a>

Here's the reference (http://www.devguru.com/Technologies/ecmascript/quickref/win_open.html) for the details of window features.