Page 1 of 1

New window function as hyperlink - non-javascript compatible

Posted: Thu Dec 16, 2004 4:38 pm
by Chris Corbyn
Hi,

I've got a function the opens a new window and that's all simple enough. But I'm implementing it like this

Code: Select all

<a href="javascript:openWindow('myWin.html','newWindow','width=300,height=400')">Click me</a>
The only thing is... I want this to at the very least open a window on browsers not supporting javascript.

I tried puuting an onClick event combined with a standard hyperlink and a target attribute but this causes two windows to open on a javascript enabled browser.

What is the technique for increasing accessibility for this kind of thing?

Cheers :-)

Posted: Thu Dec 16, 2004 4:54 pm
by timvw
just a guess here:

use the standard link.. to a _new or _blank target... and in that target.html place the resize code in the onload method?

Posted: Thu Dec 16, 2004 4:57 pm
by jason
I use this:

Code: Select all

<script type="text/javascript"><!--
	document.write('<a onclick="dialog(''page.php'', 500, 410);" href="javascript:void(0)">What is this?</a>');
--></script>
<noscript><a href="Cvv2.php" target="_blank">What is this?</a></noscript>
Basically, if JavaScript is good, it will write out the link, otherise, the noscript tags will display the normal link.

Posted: Fri Dec 17, 2004 6:12 am
by Chris Corbyn
Thanks jason that's probably the best idea. timvw the only problem was that i didn't mention the fact that what I'm actually doing is opening a new window with nothing in it and then writing code via javascript to that window to construct the contents dynamically.

Not sure onLoad works in that way. I didn't mention it though ;-)

I'll do the noscript idea :-)

Posted: Fri Dec 17, 2004 6:13 am
by Chris Corbyn
Jason, is that photo yourself? ;-) Hot! 8)