Hey there,
I recently moved our site to a new server, and after the move I'm getting a javascript error, when loading our pages. I'm not sure what's wrong, as I thought javascript was browserbased and not depending on any server side software?
The error is that cat7_color is undefined. The script in use is the following:
<script type="text/javascript">
var cat0_prodtype = new Array('');
var cat1_prodtype = new Array('1_Push-up','2_Bøjle','30_Ammebh');
var cat17_prodtype = new Array('20_Korset','21_Bustier','6_Corsage');
var cat16_prodtype = new Array('18_Bikini','19_Badedragt','22_Uden indlæg','28_Skørt');
var cat15_prodtype = new Array('16_Selvsiddende','17_Strømpebukser');
var cat7_prodtype = new Array('5_G-streng','7_Hotpants','8_Hipsters','9_Tanga');
var cat8_prodtype = new Array('25_Neglige','27_Babydoll');
var cat19_prodtype = new Array('29_Top');
var cat20_prodtype = new Array('10_Body');
document.getElementById('size_sel').style.visibility = 'hidden'; //hide size field by default
document.search_product.sco.disabled = true; //disable color field by default
document.search_product.spt.disabled = true; //disable product type field by default
color_size_prodtype('',''); //initiate
function color_size_prodtype(selected_color,selected_prodtype) {
catbox = document.search_product.sc;
colorbox = document.search_product.sco;
prodtypebox = document.search_product.spt;
if (catbox.selectedIndex > 0) { //if a category was selected
//
// initialize product type field
//
prodtypebox.disabled = false;
var first_prodtype_text = 'Alle typer';
var the_prodtype_array = eval('cat' + catbox.options[catbox.selectedIndex].value + '_prodtype');
if (the_prodtype_array.length == 1 && the_prodtype_array[0] == 'Ikke relevant') {
first_prodtype_text = '';
prodtypebox.disabled = true;
selected = '';
} else {
selected = selected_prodtype;
}
SetOptions(prodtypebox, the_prodtype_array,'number',first_prodtype_text,selected);
//
// initialize color field
//
colorbox.disabled = false;
var first_color_text = 'Alle farver';
var the_color_array = eval('cat' + catbox.options[catbox.selectedIndex].value + '_color');
if (the_color_array.length == 1 && the_color_array[0] == 'Ikke relevant') {
first_color_text = '';
colorbox.disabled = true;
selected = '';
} else {
selected = selected_color;
}
SetOptions(colorbox, the_color_array,'text',first_color_text,selected);
//
// initialize sizes
//
if (catbox.options[catbox.selectedIndex].value == 1) {
document.getElementById('size_sel').style.visibility = 'visible';
} else {
document.getElementById('size_sel').style.visibility = 'hidden';
}
} else {
document.getElementById('size_sel').style.visibility = 'hidden';
colorbox.disabled = true;
prodtypebox.disabled = true;
}
}
</script>
According to Internet explorer, the error is in the following line, character 5:
var the_color_array = eval('cat' + catbox.options[catbox.selectedIndex].value + '_color');
if somebody is able to help out, I'd really apreciate it 🙂
Thanks,
Jesper