My company currently lacks a JavaScript author, so i’m trying to figure this stuff out as a web designer (who knows html & css). I’ve been able to edit these files successfully in the past, but for some reason the changes i make are no longer working and i don’t know enough about JS to determine why.
on one of our product pages we have a drop-down “selection” form that asks a few questions to determine which product is best suited for the user. In the JS function there’s an array with a series of on/off markers that translate to yes/no for the corresponding client-side form choices. Products 0-9 work as intended but 10 and 11 are not. They remain staticly displayed on the page.
here is the .js file
[CODE]var speaks = null;
function initSpeaks()
{
speaks = new Array(23);
speaks[0]=”xxx.xx…xSRM150″;
speaks[1]=”xxxxxx…xSRM350″;
speaks[2]=”xxxxxxxx.xSRM450″;
speaks[3]=”xxx.xxx..xSWA1501″;
speaks[4]=”xxx.xxxx.xSWA1801z”;
speaks[5]=”xxx.xxxx.xSWA2801z”;
speaks[6]=”xxxxxx..x.C200″;
speaks[7]=”xxxxxxxxx.C300z”;
speaks[8]=”x.xxxxxx.xHD1521″;
speaks[9]=”x.xxxxxx.xHD1531″;
speaks[10]=”xxx.xx…xTH15A”;
speaks[11]=”xxx.xx…xTH18S”;
}
function DOM(n)
{
return document.getElementById(n);
}
function showMatches()
{
if ( speaks == null )
initSpeaks();
var spk_use, spk_audience, spk_amp;
spk_use = DOM(“spk_use”).value;
spk_audience = DOM(“spk_audience”).value;
spk_amp = DOM(“spk_amp”).value;
if ( spk_use == 1 )
{
DOM(“spk_audience”).disabled = true;
DOM(“spk_audience”).selectedIndex = 0;
}
else
{
DOM(“spk_audience”).disabled = false;
}
var i;
for ( i = 0 ; i < 23 ; i++ )
{
var nm = “st_” + speaks[i].substring( 10, 255 );
var o = DOM(nm);
if ( o == null )
{
// alert(nm);
continue;
}
if ( speaks[i].substr( spk_use, 1 ) == ‘x’ &&
speaks[i].substr( spk_audience, 1 ) == ‘x’ &&
speaks[i].substr( spk_amp, 1 ) == ‘x’ )
{
o.className = “rotate”;
}
else
{
o.className = “rotate_off”;
}
}
// hide SRM450 for mains in large audiences
if ( spk_use == 4 && spk_audience > 5 )
{
DOM(“st_SRM450”).className = “rotate_off”;
}
}
// JavaScript Document
//<![CDATA[
function DOM(n)
{
if (document.all) return(document.all[n]);
if (document.getElementById) return(document.getElementById(n));
return(null);
}
function toggleDisplay( n )
{
var o = DOM(n);
if ( o == null )
return;
o.style.display = (o.style.display == ”) ? “none” : “”;
}
function hide( n ) {
var o = DOM(n);
if ( o == null )
{
alert(n);
return;
}
if ( o.style.display == “” )
o.style.display = “none”;
}
function show( n ) {
var o = DOM(n);
if ( o == null )
{
alert(n);
return;
}
if ( o.style.display == “none” )
o.style.display = “”;
}
function showpanel( n ) {
hide(“panel_default”);
hide(“panel_srm150”);
hide(“panel_srm350”);
hide(“panel_srm450”);
hide(“panel_hd1521”);
hide(“panel_hd1531”);
hide(“panel_swa1501”);
hide(“panel_swa1801z”);
hide(“panel_swa2801z”);
hide(“panel_c200”);
hide(“panel_c300z”);
hide(“panel_th15a”);
hide(“panel_th18s”);
show( n );
}
//]]>
i’ve tried a few things based on guesses but nothing worked. if someone could tell me how to fix i would be very happy.