Forum Moderators: open
var arrayData = new Array();
arrayData[0]= 'ANNAQR¦Product Item 0¦'
arrayData[1]= 'ANNAST¦Product Item 1¦'
arrayData[2]= 'ANNAUV¦Product Item 2¦'
arrayData[3]= 'ANNAWX¦Product Item 3¦'
arrayData[4]= 'ANNAYZ¦Product Item 4¦'
arrayData[5]= 'BNNBAA¦Product Item 5¦'
arrayData[6]= 'BNNBCC¦Product Item 6¦'
arrayData[7]= 'BNNBDD¦Product Item 7¦'
arrayData[8]= 'BNNBEE¦Product Item 8¦'
arrayData[9]= 'BNNBFF¦Product Item 9¦'
function populateData( name ) {
select= window.document.Main.Product;
string= "";
// 0 - will display the new options only
// 1 - will display the first existing option plus the new options
count= 0;
// Clear the old list (above element 0)
select.options.length = count;
// Place all matching Carriers into Options.
for( i = 0; i < arrayData.length; i++ ) {
string = arrayData[i].split( "¦" );
if( string[0] == name ) {
select.options[count++] = new Option( string[1] );
}
}
// Set which option from Product is to be selected
//select.options.selectedIndex = 0;
// Give Product focus and select it
//select.focus();
HideSelect();
}
function HideSelect() {
if (window.document.Main.Carrier.options[0].selected) {
window.document.Main.Product.style.visibility = "hidden";
} else {
window.document.Main.Product.style.visibility = "visible";
}
}
function SelObj(formname,selname,textname,str) {
this.formname = formname;
this.selname = selname;
this.textname = textname;
this.select_str = str ¦¦ '';
this.selectArr = new Array();
this.initialize = initialize;
this.bldInitial = bldInitial;
this.bldUpdate = bldUpdate;
}
function initialize() {
if (this.select_str =='') {
for(var i=0;i<document.forms[this.formname][this.selname].options.length;i++) {
this.selectArr[i] = document.forms[this.formname][this.selname].options[i];
this.select_str += document.forms[this.formname][this.selname].options[i].value+":"+
document.forms[this.formname][this.selname].options[i].text+",";
}
}
else {
var tempArr = this.select_str.split(',');
for(var i=0;i<tempArr.length;i++) {
var prop = tempArr[i].split(':');
this.selectArr[i] = new Option(prop[1],prop[0]);
}
}
return;
}
function bldInitial() {
this.initialize();
for(var i=0;i<this.selectArr.length;i++)
document.forms[this.formname][this.selname].options[i] = this.selectArr[i];
document.forms[this.formname][this.selname].options.length = this.selectArr.length;
return;
}
function bldUpdate() {
var str = document.forms[this.formname][this.textname].value.replace('^\\s*','');
if(str == '') {this.bldInitial();return;}
this.initialize();
var j = 0;
pattern1 = new RegExp("^"+str,"i");
for(var i=0;i<this.selectArr.length;i++)
if(pattern1.test(this.selectArr[i].text))
document.forms[this.formname][this.selname].options[j++] = this.selectArr[i];
document.forms[this.formname][this.selname].options.length = j;
if(j==1){
document.forms[this.formname][this.selname].options[0].selected = true;
//document.forms[this.formname][this.textname].value = document.forms[this.formname][this.selname].options[0].text;
}
}
function setUp() {
obj1 = new SelObj('Main','Carrier','SearchCarriers');
obj1.bldInitial();
}
-->
</script>
</HEAD>
<BODY vLink=#003366 link=#003366 bgColor=#ffffff OnLoad="HideSelect();" OnLoad="setUp();"><LINK
href="InsuranceDemoNew2_files/style.css" type=text/css rel=STYLESHEET>
<DIV>
<!-- dark blue section: Carrier Options -->
<TABLE cellSpacing=0 cellPadding=4 width="100%" border=0>
<TBODY>
<TR>
<TD class=accttblhdr align=middle height=18><SPAN
class=accttblhdr colspan=2>Carrier Options</SPAN></TD>
</TR>
</TBODY>
</TABLE>
<!-- light blue section: Carrier Options -->
<TABLE cellSpacing=1 cellPadding=2 width="100%" border=0 height="458">
<TBODY>
<TR><TD class=oddrow align=left height="19"> </TD>
<TD class=oddrow align=left height="19"> </TD></TR>
<!-- <TR><TD class=oddrow height="19"> </TD>
<TD class=oddrow height="19"> </TD></TR>
<TR><TD class=oddrow align=left height="19"> </TD>
<TD class=oddrow align=left height="19"> </TD></TR>
<TR> -->
<TD class=oddrow height="11">
</TD>
<TD class=oddrow height="11">
</TD></TR>
<TR><TD class=oddrow align=left height=28 colspan=2><SPAN class=pgtxt>
To retrieve a product, enter the name of the carrier below. You may also perform a search by entering a portion of the name.</td>
</SPAN></TD>
</TR>
<tr>
<form name=Main method=post onSubmit="javascript:window.location = document.Main.Carrier.options[document.Main.Carrier.selectedIndex].value;return false;">
<TD class=oddrow align=left height="20" colspan=2><SPAN class=pgtxt>
<input type="radio"name="grpCarrier" value="starting with" checked> starting with
<input type="radio" name="grpCarrier" value=""> contains
<input maxLength="30" size="30" name="SearchCarriers" >
<img border="0" src="InsuranceDemoNew2_files/Search.bmp" WIDTH="51" HEIGHT="14" onClick="javascript:obj1.bldUpdate();"></TD>
</tr>
<tr>
<TD class=oddrow height="1"><B>Carrier</B></td>
<TD class=oddrow height="1";> <B>Product</B></td>
</tr>
<tr>
<TD class=oddrow height="71" ><SPAN class=pgtxt>
<select name="Carrier" size=4;"
onChange='javascript:populateData( this.options[selectedIndex].text)'; >
<option value="option0" selected></option>
<option value="option1"> ANNAQR </option>
<option value="option2"> ANNAST </option>
<option value="option3"> ANNAUV </option>
<option value="option4"> ANNAWX </option>
<option value="option5"> ANNAYZ </option>
<option value="option6"> BNNBAA </option>
<option value="option7"> BNNBCC </option>
<option value="option8"> BNNBDD </option>
<option value="option9"> BNNBEE </option>
<option value="option10"> BNNBFF </option>
</select> </SPAN> </td>
<TD class=oddrow height="71" ><SPAN class=pgtxt>
<select name="Product" size=4" >
</select></SPAN>
</td>
</form>
</tr>