[thelist] javascript opening new window question

Emily Tarrant emily.tarrant at dsl.pipex.com
Thu Jun 23 12:25:04 CDT 2005


Hey everyone

I'm playing around with a photo gallery at the moment and would like a 
new window to open when I click on the thumbnail. The code I've got so 
far is this:

-----

(In head)

<script language="javascript" type="text/javascript">

function newWindow(galleryjpg) {
    galleryWindow = window.open(galleryjpg, "galleryWin", 
"width=620,height=470")
    galleryWindow.focus()
}

</script>


(Link)
<a href="javascript:newWindow('images/blah.jpg')">Thumbnail image</a>

-----

I know that javascript links are a big no-no because they don't work if 
you're using a non-javascript browser, but is there any way of adapting 
this so that the link still works when javascript is disabled? Or is 
there a better way of doing it??

Cheers for any suggestions.

Emily



More information about the thelist mailing list