Click to See Complete Forum and Search --> : Triggering a window from a Image


davesouth
07-20-2003, 04:29 PM
Hello all, I'm brand new here ;) and had a quick qestion for the experienced ones.

I am very excited about Javascript's ability to change the settings of a new window (ex. no scroll bars) but I cant figure out how to call this Function into play!

I have only seen this function called by a Forum button (IE) and was wondering if it is possible to do this by a image link
(what I really want Is to launch a new window from a Image)

Here's what I have so far (Im new so if I have something wrong, by all means shout at me :D )

<SCRIPT LANGUAGE="javascript">
function openindex()
{
window.open ('main.html', 'newwindow', config='height=100, width=400, toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, directories=no, status=no')
}
</SCRIPT>

And here is my call function :

onClick='openindex()'

But I don't know how to get the new window to open after clicking on the image!
(ex. <a ><img scr="img.jpg"></a> ????)

I think i'm very close, but I could be wrong, so please help me out :)

pyro
07-20-2003, 04:34 PM
Try something like this:

<a href="main.html" onclick="openindex(); return false;"><img scr="img.jpg"></a>

Also, in your window.open change config to properties...

Then, one more thing... Change <script language="javascript"> to <script type="text/javascript">. The language attribute has been depreciated.

davesouth
07-20-2003, 04:39 PM
Thank you VERY much pyro! Your soulution works perfectly

That really had me stumped for a while ;)

Thanks :D

pyro
07-20-2003, 04:41 PM
No problem. Glad I could help...

Cheers! :D