Hi,
I am using Javascript to display options in a form with 2 dropdown lists. However, despite using the target=‘_self’, the result opens in a new window. Help would be much appreciated.
Javascript…
// JavaScript Document
function setOptions(chosen) {
var selbox = document.ChronoContact_course_finder.opttwo;
selbox.options.length = 0;
if (chosen == ' ') {
selbox.options[selbox.options.length] = new Option('Choose Option',' ');
}
if (chosen == '85') {
selbox.options[selbox.options.length] = new Option('ITEC Beauty Specialist Diploma','index.php?option=com_content&view=article&id=49&Itemid=68',target='_self');
selbox.options[selbox.options.length] = new Option('ITEC Professional Makeup','index.php?option=com_content&view=article&id=57&Itemid=76',target='_self');
selbox.options[selbox.options.length] = new Option('Fashion Catwalk & Photographic Makeup Course','index.php?option=com_content&view=article&id=67&Itemid=91',target='_self');
selbox.options[selbox.options.length] = new Option('Bridal Makeup Course','index.php?option=com_content&view=article&id=68&Itemid=92',target='_self');
selbox.options[selbox.options.length] = new Option('Special Effects Makeup','index.php?option=com_content&view=article&id=56&Itemid=77',target='_self');
selbox.options[selbox.options.length] = new Option('Gel Nails Course','index.php?option=com_content&view=article&id=65&Itemid=88',target='_self');
selbox.options[selbox.options.length] = new Option('Acrylic Nails Course','index.php?option=com_content&view=article&id=66&Itemid=89',target='_self');
selbox.options[selbox.options.length] = new Option('Spray Tanning Course','index.php?option=com_content&view=article&id=55&Itemid=73',target='_self');
}
if (chosen == '69') {
selbox.options[selbox.options.length] = new Option('ITEC Holistic Massage Course','index.php?option=com_content&view=article&id=51&Itemid=2',target='_self');
selbox.options[selbox.options.length] = new Option('ITEC Sports Massage Diploma','index.php?option=com_content&view=article&id=59&Itemid=78',target='_self');
selbox.options[selbox.options.length] = new Option('Indian Head Massage Course','index.php?option=com_content&view=article&id=60&Itemid=79',target='_self');
selbox.options[selbox.options.length] = new Option('ITEC Reflexology Diploma','index.php?option=com_content&view=article&id=64&Itemid=87',target='_self');
}
if (chosen == '80') {
selbox.options[selbox.options.length] = new Option('ITEC Teaching Diploma','index.php?option=com_content&view=article&id=61&Itemid=81',target='_self');
selbox.options[selbox.options.length] = new Option('FETAC Train The Trainer Level 6','index.php?option=com_content&view=article&id=63&Itemid=86',target='_self');
}
if (chosen == '83') {
selbox.options[selbox.options.length] = new Option('ITEC Sports Massage Diploma','index.php?option=com_content&view=article&id=59&Itemid=90',target='_self');
}
}
And the HTML…
<div class="form_item">
<div class="form_element cf_heading">
<h1 class="cf_text">course finder</h1>
</div>
<div class="cfclear"> </div>
</div>
<div class="form_item">
<div class="form_element cf_dropdown">
<label class="cf_label" style="width: 200px;">Step 1: Choose type of course</label>
<select name="optone" class="cf_inputbox" size="1" onchange="setOptions(document.ChronoContact_course_finder.optone.options[document.ChronoContact_course_finder.optone.selectedIndex].value);">
<option value=" " selected="selected">Choose Option</option>
<option value="85">Beauty courses</option>
<option value="69">Complimentary courses</option>
<option value="80">Teaching courses</option>
<option value="83">Fitness courses</option>
</select>
</div>
<div class="cfclear"> </div>
</div>
<div class="form_item">
<div class="form_element cf_dropdown">
<label class="cf_label" style="width: 200px;">Step 2: Choose a subject</label>
<select size="1" name="opttwo" class="cf_inputbox" >
<option value=" " selected="selected">Choose Option</option>
</select>
<!--<input type="button" name="go" value="Value Selected" onclick="window.open(document.ChronoContact_course_finder.opttwo.options[document.ChronoContact_course_finder.opttwo.selectedIndex].value);">-->
</div>
<div class="cfclear"> </div>
</div>
<div class="form_item">
<div class="form_element cf_button">
<input type="submit" name="go" value="search" onclick="window.open(document.ChronoContact_course_finder.opttwo.options[document.ChronoContact_course_finder.opttwo.selectedIndex].value);">
</div>
<div class="cfclear"> </div>
</div>
Many thanks!