Boomerang very kindly gave me the code below to call up a separate web page depending on which combination of checkboxes are ticked. Unfortunately I can't get it to work. I've set up a test page at I've been over the code with a fine toothcomb but can't see what I'm doing wrong. Ideally I'd like the new page to open in the same window without opening a separate one. Any help would be greatly appreciated as my colleague and I spent hours on this and got nowhere!
<html>
<head>
</head>
<body>
<script language="javascript">
function opensite()
{
var endvalue = "";
var DM = document.MyForm1;
var NrCbs = DM.cb1.length;
var a = "google.com";
var b = "yahoo.com";
var c = "CNN.com";
var ab= "microsoft.com";
var ac= "netscape.com";
var bc = "W3.org";
var abc = "tek-tips.com";
var preURL = "
for (ia = parseInt(0); ia < NrCbs; ia++)
{
if (DM.cb1[ia].checked)
endvalue = endvalue + DM.cb1[ia].value;
}
defURL = eval("'" + preURL + eval(endvalue) + "'"
if (!endvalue == ""
{
window.open(defURL, 'windowname3','toolbar=yes, location=yes,
directories=yes, status=yes, menubar=yes, resizable=yes,
scrollbars=yes, top=0, left=0, height=600, width=800');
}
else
{
alert("no checkboxes are selected"
}
}
</script>
<form name="MyForm1">
a: <INPUT TYPE="checkbox" value="a" name=cb1>
b: <INPUT TYPE="checkbox" value="b" name=cb1>
c: <INPUT TYPE="checkbox" value="c" name=cb1>
<br>
<input type="submit" value="go to the site" name="submit777"
ONCLICK="opensite()">
</form>
</body>
</html>
<html>
<head>
</head>
<body>
<script language="javascript">
function opensite()
{
var endvalue = "";
var DM = document.MyForm1;
var NrCbs = DM.cb1.length;
var a = "google.com";
var b = "yahoo.com";
var c = "CNN.com";
var ab= "microsoft.com";
var ac= "netscape.com";
var bc = "W3.org";
var abc = "tek-tips.com";
var preURL = "
for (ia = parseInt(0); ia < NrCbs; ia++)
{
if (DM.cb1[ia].checked)
endvalue = endvalue + DM.cb1[ia].value;
}
defURL = eval("'" + preURL + eval(endvalue) + "'"
if (!endvalue == ""
{
window.open(defURL, 'windowname3','toolbar=yes, location=yes,
directories=yes, status=yes, menubar=yes, resizable=yes,
scrollbars=yes, top=0, left=0, height=600, width=800');
}
else
{
alert("no checkboxes are selected"
}
}
</script>
<form name="MyForm1">
a: <INPUT TYPE="checkbox" value="a" name=cb1>
b: <INPUT TYPE="checkbox" value="b" name=cb1>
c: <INPUT TYPE="checkbox" value="c" name=cb1>
<br>
<input type="submit" value="go to the site" name="submit777"
ONCLICK="opensite()">
</form>
</body>
</html>