New window function as hyperlink - non-javascript compatible

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

New window function as hyperlink - non-javascript compatible

Post 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 :-)
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post 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?
jason
Site Admin
Posts: 1767
Joined: Thu Apr 18, 2002 3:14 pm
Location: Montreal, CA
Contact:

Post 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.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post 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 :-)
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

Jason, is that photo yourself? ;-) Hot! 8)
Post Reply