...

View Full Version : Which part of this script generates a pop-up?



Stromgren
03-02-2012, 04:28 PM
Hello

I needed an interdependent form for my website and found a JavaScript that would do the trick.

Now i have no knowledge in JavaScript but i managed to set this up right. But i seems some part of the script makes a popup window which is showing what is chosen in the form and i reeeally want to remove that :)

Can anyone pick out which piece of the script i need to remove?

Thanks in advance :)



var ss2Values = [
// 'Please choose a subject'
['Please choose a category'],
// '3D Printer'
['Please choose a category', 'Darwin', 'Huxley', 'MendelMax', 'Original Mendel', 'Printrbot', 'Prusa Mendel', 'Wallace', 'Upgrades'],
// 'Home'
['Please choose a category', 'Bathroom', 'Bedroom', 'Decorations', 'Furniture', 'Home utilities', 'Household items', 'Kitchen', 'Livingroom', 'Outdoor', 'Spareparts'],
// 'Mechanical'
['Please choose a category', 'Gears', 'Nuts and bolts', 'Tracks and bogies'],
// 'Electrical'
['Please choose a category', 'Battery boxes', 'Terminal blocks', 'Outlet boxes'],
// 'Electrical'
['Please choose a category', 'Architectural', 'Games', 'Ornaments', 'Toys'],
// 'Educational'
['Please choose a category', 'Biological models', 'Chemical models', 'Mathematical', 'Physical models']
];
window.onload = function()
{
var ss2 = new xSubSelect('sel20', 'sel21', null, ss2Values, ss2OnChange);
}
function ss1OnChange(s0, s1, s2)
{
alert(
s0.options[s0.selectedIndex].value + ' / '
+ s1.options[s1.selectedIndex].value + ' / '
+ s2.options[s2.selectedIndex].value
);
}
function ss2OnChange(s0, s1)
{
alert(
s0.options[s0.selectedIndex].value + ' / '
+ s1.options[s1.selectedIndex].value
);
}
function xSubSelect(sSelId0, sSelId1, sSelId2, aValues, fnOnChange)
{
var s0 = document.getElementById(sSelId0);
var s1 = document.getElementById(sSelId1);
var s2 = sSelId2 ? document.getElementById(sSelId2) : null;
if (s0 && s1)
{
s0.onchange = function()
{
var i, len, val;
// clear existing options for s1
len = s1.options.length;
for (i = 0; i < len; ++i)
{
s1.options[0] = null;
}
// insert new options for s1
len = aValues[s0.selectedIndex].length;
for (i = 0; i < len; ++i)
{
val = aValues[s0.selectedIndex][i];
s1.options[i] = new Option(s2 ? val[0] : val);
}
// update s2
if (s2)
{
s1.onchange();
}
};
if (s2)
{
s1.onchange = function()
{
var i, len;
// clear existing options for s2
len = s2.options.length;
for (i = 0; i < len; ++i)
{
s2.options[0] = null;
}
// insert new options for s2
len = aValues[s0.selectedIndex][s1.selectedIndex].length;
for (i = 1; i < len; ++i)
{
s2.options[i - 1] = new Option(aValues[s0.selectedIndex][s1.selectedIndex][i]);
}
};
s2.onchange = function()
{
if (fnOnChange)
{
fnOnChange(s0, s1, s2);
}
};
}
else
{
s1.onchange = function()
{
if (fnOnChange)
{
fnOnChange(s0, s1);
}
};
}
s0.onchange(); // first init
}
}

vwphillips
03-02-2012, 04:40 PM
change


window.onload = function()
{
var ss2 = new xSubSelect('sel20', 'sel21', null, ss2Values, ss2OnChange);
}

to

window.onload = function()
{
var ss2 = new xSubSelect('sel20', 'sel21', null, ss2Values,false);
}

Stromgren
03-02-2012, 05:09 PM
Thanks a lot, working perfectly :)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum