PDA

View Full Version : listbox combo problem



gilgalbiblewhee
May 11th, 2006, 02:36 AM
I have several on my list that don't have a subtitle. Instead I want the onchange to take directly to the page assigned. Whereas the ones with subtitles I want them to open them in the second listbox.


<form name="firstexample" onsubmit="return(false);">
<table align="center" bgcolor="beige" border="1">
<tbody><tr><th class="featureheader">Publishers</th><th class="featureheader">Titles</th></tr>
<script language="javascript"><!--
function comboItemSelected(oList1,oList2){
if (oList2!=null){
clearComboOrList(oList2);
if (oList1.selectedIndex == -1){
oList2.options[oList2.options.length] = new Option('Please make a selection from the list', '');
} else {
fillCombobox(oList2, oList1.name + '=' + oList1.options[oList1.selectedIndex].value);
}
}
}
function listboxItemSelected(oList1,oList2){
if (oList2!=null){
clearComboOrList(oList2);
if (oList1.selectedIndex == -1){
oList2.options[oList2.options.length] = new Option('Please make a selection from the list', '');
} else {
fillListbox(oList2, oList1.name + '=' + oList1.options[oList1.selectedIndex].value);
}
}
}
function clearComboOrList(oList){
for (var i = oList.options.length - 1; i >= 0; i--){
oList.options[i] = null;
}
oList.selectedIndex = -1;
if (oList.onchange) oList.onchange();
}
function fillCombobox(oList, vValue){
if (vValue != '') {
if (assocArray[vValue]){
oList.options[0] = new Option('Please make a selection', '');
var arrX = assocArray[vValue];
for (var i = 0; i < arrX.length; i = i + 2){
if (arrX[i] != 'EOF') oList.options[oList.options.length] = new Option(arrX[i + 1].split('&amp;').join('&'), arrX[i]);
}
if (oList.options.length == 1){
oList.selectedIndex=0;
if (oList.onchange) oList.onchange();
}
} else {
oList.options[0] = new Option('None found', '');
}
}
}
function fillListbox(oList, vValue){
if (vValue != '') {
if (assocArray[vValue]){
var arrX = assocArray[vValue];
for (var i = 0; i < arrX.length; i = i + 2){
if (arrX[i] != 'EOF') oList.options[oList.options.length] = new Option(arrX[i + 1].split('&amp;').join('&'), arrX[i]);
}
if (oList.options.length == 1){
oList.selectedIndex=0;
if (oList.onchange) oList.onchange();
}
} else {
oList.options[0] = new Option('None found', '');
}
}
}
//--></script>
<script language="Javascript">
//<!--Hide script from old browsers
//with dropdownpreface.txt
function gotoArticle(art) {
if(art!='') {
location.href=art;
}
}
//-->
</script>
<tr><td>
<select name="example1_list1" size="8" style="width: 400px;" onchange="listboxItemSelected(this,this.form.example1_list2),gotoArticle(this.value);">
<option value="1">What Is Freemasonry?</option>
<option value="2">Freemasonry And Mystery Babylon: A Pagan Religion</option>
<option value="3">Modern Freemasonry: An Historical Overview</option>
<option value="4">The Spread of Freemasonry From The Mother Lodge</option>
<option value="5">A Bitter Conflict</option>
<option value="TheSpreadofFrenchFreemasonry.asp">The Spread of French Freemasonry</option>
<option value="sub-masoniclodges.asp">Sub-Masonic Lodges</option>
<option value="TheBenevolentDeceptionofFreemasonry.asp">The Benevolent Deception of Freemasonry</option>
<option value="DegreesofInitiationandKnowledge.asp">Degrees of Initiation and Knowledge</option>
<option value="TheMasonicHierarchyandConspiracy.asp">The Masonic Hierarchy and Conspiracy</option>
<option value="MasonicPreachingandPropaganda.asp">Masonic Preaching and Propaganda</option>
<option value="TheDeceptionofChristians.asp">The Deception of Christians</option>
<option value="InThreeVolumes.asp">Scarlet and The Beast: In Three Volumes</option>
<option value="albertpike.asp">Portrait of 33rd Degree Freemason Albert Pike</option>
<option value="symbolofthebaphomet.asp">Symbol of The Baphomet</option>
<option value="Scarlet.asp">Scarlet</option>
<option value="beast.asp">The Beast</option>
</select>
</td>

<td>
<select name="example1_list2" size="5" style="width: 360px;" onchange="gotoArticle(this.value);">
<option value="whatisfreemasonry.asp">A Word About Sources</option>
<option value="theuniversalreligionoffreemasonry.asp">The Universal Religion of Freemasonry</option>
<option value="SalvationWithoutChrist.asp">Salvation Without Christ</option>
<option value="AFalseReligionofWorks.asp">A False Religion of Works</option>
</select>

<script language="javascript">

if (!assocArray) var assocArray = new Object();

assocArray["example1_list1=1"] = new Array(
"whatisfreemasonry.asp","A Word About Sources",
"theuniversalreligionoffreemasonry.asp","The Universal Religion of Freemasonry",
"SalvationWithoutChrist.asp","Salvation Without Christ",
"AFalseReligionofWorks.asp","A False Religion of Works",
"EOF");

assocArray["example1_list1=2"] = new Array(
"TheTowerofBabelandSolomonsTemple.asp","The Tower of Babel and Solomon's Temple",
"FreemasonryandAntiSemitism.asp","Freemasonry and Anti-Semitism",
"EOF");

assocArray["example1_list1=3"] = new Array(
"modernfreemasonry.asp","Modern Freemasonry",
"therosicrucians.asp","The Rosicrucians",
"thetemplars.asp","The Templars",
"FrenchandEnglishFreemasonry.asp","French and English Freemasonry",
"EOF");

assocArray["example1_list1=4"] = new Array(
"TheYorkandScottishRitesinAmerica.asp","The York and Scottish Rite in America",
"EOF");

assocArray["example1_list1=5"] = new Array(
"EnglishversusFrenchfreemasonry.asp","English Freemasonry Versus French Freemasonry!",
"EOF");

</script>

</td>
</tr>
</tbody></table>
</form>