The code seems to do that, except if the check box is not checked and you click a link, the checkbox becomes checked, and the link is opened in both a new window and the current window, which defeats the purpose.
here is my code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>My Links</title>
<link rel="stylesheet" href="style.css" type="text/css" />
<script language="javascript" type="text/javascript">
/* <[CDATA[ */
function showLink(target)
{
if (document.links.newwindow.checked = true)
window.open(target, "Link_Window", "toolbar=no,
menubar=no, resizable=yes, scrollbars=yes,
height=800, width=600");
}
/* ]]> */
</script>
</head>
<body>
<div id="wrapper">
<h1>Simon's Favorite Links</h1>
<form action="" name="links">
<label>Check to open link in a new window</label>
<input type="checkbox" name="newWindow"/>
<ul>
<li><a href="http://www.dougrappoport.com"
onclick="showLink('http://
www.dougrappoport.com')"> Doug
Rappoport.com</a></li>
<li><a href="http://www.dice.com">Dice.com</a></li>
<li><a href="http://www.dreamincode.net">Dream-
In-Code forums</a></li>
<li><a href="http://www.pandora.com">Pandora
Radio</a></li>
<li><a href="http://validator.w3.org">W3C
Validator</a></li>
</ul>
</form>
</div>
</body>
</html>
This post has been edited by teahou: 23 April 2011 - 07:19 PM

New Topic/Question
Reply


MultiQuote





|