Here is a script I can't get to work correctly. It's purpose is to check whether a check box is checked and then to call a second routine that responds, dependent on what the selectedindex (sindex) was shown to be when I originally called the script
<script type="text/javascript">
function checkB(ctrl,sindex) { //get the state of the check box
var sindex = {
0: 0,
1: 1,
2: 2,
3: 3
};
if (ctrl.checked == true) {
return function( which ) {
replaceContentmainobjectOn(sindex [which]);
} else {
if (ctrl.checked == false) {
replaceContentmainobjectOff();
}
}
}
</script>
here is the second script that is called
var replaceContentmainobjectOn =(function() {
var info = {
0: 2,
1: 1,
2: 2,
3: 3
};
return function( which ) {
document.getElementById('ecwid-productoption-8840317-mainobject').selectedIndex = ( info[ which ] ) ;
};
}())
This is what I'm calling the first routine with
onclick="checkB(this,sindex);