Hi,
I have a problem.
I suspect something is wrong with the sequence in which the events fire, because my OnChange event for SearchBy drop-down list works only until OnChange event for DisplayBy fires, then if I come back to SearchBy drop-down box and change the values, OnChange event does not fire.
Please help me. I am stuck with this for quite a while already.
You can copy and paste the following to see what happens.
<html>
<head>
<title>PC Refresh Charges</title>
<style fprolloverstyle>A:hover {color:#ff9900; font-weight: bold}
</style>
<SCRIPT LANGUAGE="JavaScript">
function ChangeValues()
{
var theOptions=["Name","Rollup/Bill To Transit","Physical Transit"];
document.all.tblPh_tr.style.display='none'
document.all.tblBl_tr.style.display='none'
document.all.tblName.style.display='none'
if (document.all.DisplayBy.value=="Charges"
{
numOptions=2;
document.all.SearchBy.options.length=0; //clears options
for (count=0;count<numOptions;count++)
{
document.all.SearchBy.options[count] = new Option (theOptions[count]);
}
document.all.tblName.style.display='block'
} else
{
numOptions=3;
document.all.SearchBy.options.length=0; //clears options
for (count=0;count<numOptions;count++)
{
document.all.SearchBy.options[count] = new Option (theOptions[count]);
}
document.all.tblBl_tr.style.display='block'
}
document.all.SearchBy.focus()
}
function Show()
{
if (document.all.DisplayBy.value=="Charges"
{
if (document.all.SearchBy.value=="Name"
{
document.all.tblPh_tr.style.display='none'
document.all.tblBl_tr.style.display='none'
document.all.tblName.style.display='block'
document.all.tblName.focus()}
if (document.all.SearchBy.value=="BillingTransit"
{
document.all.tblPh_tr.style.display='none'
document.all.tblBl_tr.style.display='block'
document.all.tblName.style.display='none'
document.all.tblBl_tr.focus()}
}else {
if (document.all.SearchBy.value=="PhysicalTransit"
{
document.all.tblPh_tr.style.display='block'
document.all.tblBl_tr.style.display='none'
document.all.tblName.style.display='none'
document.all.tblPh_tr.focus()}
if (document.all.SearchBy.value=="BillingTransit"
{
document.all.tblPh_tr.style.display='none'
document.all.tblBl_tr.style.display='block'
document.all.tblName.style.display='none'
document.all.tblBl_tr.focus()}
if (document.all.SearchBy.value=="Name"
{
document.all.tblPh_tr.style.display='none'
document.all.tblBl_tr.style.display='none'
document.all.tblName.style.display='block'
document.all.tblName.focus()
}
}
}
</Script>
</head>
<body>
<SELECT ID="DisplayBy" onChange="ChangeValues()">
<OPTION value="Charges"
>Charges</OPTION>
<OPTION value="Count"
>Count</OPTION>
</SELECT>
<SELECT ID="SearchBy" onChange="Show()">
<OPTION value="BillingTransit"
>Rollup/Bill To Transit</OPTION>
<OPTION value="Name"
>Name</OPTION>
</SELECT>
<table ID="tblBl_tr" STYLE="display: block "width="488">
<tr>
<td width="269"> Enter Rollup/Bill To Transit:</td>
<td width="176">
<!--webbot bot="Validation" s-data-type="Integer" s-number-separators="," i-maximum-length="5" --><INPUT NAME="BillingTransit" size=18 MAXLENGTH=5></td>
<td width="83"><INPUT TYPE="SUBMIT" VALUE="Submit"></td>
</tr>
</table>
<table ID="tblName" STYLE="display: none"width="558">
<tr>
<td width="225"> Enter Last Name:</td>
<td width="169">
<!--webbot bot="Validation" s-data-type="Integer" s-number-separators="," i-maximum-length="5" --><INPUT NAME="LastName" size=18 MAXLENGTH=5></td>
<td width="150"> </td>
</tr>
<tr>
<td width="225"> Enter First Name:</td>
<td width="169">
<!--webbot bot="Validation" s-data-type="Integer" s-number-separators="," i-maximum-length="5" --><INPUT NAME="LastName" size=18 MAXLENGTH=5></td>
<td width="150"><INPUT TYPE="SUBMIT" VALUE="Submit"></td>
</tr>
</table>
<table ID="tblPh_tr" STYLE="display: none"width="559">
<tr>
<td width="226"> Enter Physical Transit:</td>
<td width="167">
<!--webbot bot="Validation" s-data-type="Integer" s-number-separators="," i-maximum-length="5" --><INPUT NAME="PhysicalTransit" size=18 MAXLENGTH=5></td>
<td width="152"><INPUT TYPE="SUBMIT" VALUE="Submit"></td>
</tr>
</table>
<p align="justify"> </td>
</tr>
</table>
</body>
</html>
I have a problem.
I suspect something is wrong with the sequence in which the events fire, because my OnChange event for SearchBy drop-down list works only until OnChange event for DisplayBy fires, then if I come back to SearchBy drop-down box and change the values, OnChange event does not fire.
Please help me. I am stuck with this for quite a while already.
You can copy and paste the following to see what happens.
<html>
<head>
<title>PC Refresh Charges</title>
<style fprolloverstyle>A:hover {color:#ff9900; font-weight: bold}
</style>
<SCRIPT LANGUAGE="JavaScript">
function ChangeValues()
{
var theOptions=["Name","Rollup/Bill To Transit","Physical Transit"];
document.all.tblPh_tr.style.display='none'
document.all.tblBl_tr.style.display='none'
document.all.tblName.style.display='none'
if (document.all.DisplayBy.value=="Charges"
{
numOptions=2;
document.all.SearchBy.options.length=0; //clears options
for (count=0;count<numOptions;count++)
{
document.all.SearchBy.options[count] = new Option (theOptions[count]);
}
document.all.tblName.style.display='block'
} else
{
numOptions=3;
document.all.SearchBy.options.length=0; //clears options
for (count=0;count<numOptions;count++)
{
document.all.SearchBy.options[count] = new Option (theOptions[count]);
}
document.all.tblBl_tr.style.display='block'
}
document.all.SearchBy.focus()
}
function Show()
{
if (document.all.DisplayBy.value=="Charges"
{
if (document.all.SearchBy.value=="Name"
document.all.tblPh_tr.style.display='none'
document.all.tblBl_tr.style.display='none'
document.all.tblName.style.display='block'
document.all.tblName.focus()}
if (document.all.SearchBy.value=="BillingTransit"
document.all.tblPh_tr.style.display='none'
document.all.tblBl_tr.style.display='block'
document.all.tblName.style.display='none'
document.all.tblBl_tr.focus()}
}else {
if (document.all.SearchBy.value=="PhysicalTransit"
document.all.tblPh_tr.style.display='block'
document.all.tblBl_tr.style.display='none'
document.all.tblName.style.display='none'
document.all.tblPh_tr.focus()}
if (document.all.SearchBy.value=="BillingTransit"
document.all.tblPh_tr.style.display='none'
document.all.tblBl_tr.style.display='block'
document.all.tblName.style.display='none'
document.all.tblBl_tr.focus()}
if (document.all.SearchBy.value=="Name"
document.all.tblPh_tr.style.display='none'
document.all.tblBl_tr.style.display='none'
document.all.tblName.style.display='block'
document.all.tblName.focus()
}
}
}
</Script>
</head>
<body>
<SELECT ID="DisplayBy" onChange="ChangeValues()">
<OPTION value="Charges"
>Charges</OPTION>
<OPTION value="Count"
>Count</OPTION>
</SELECT>
<SELECT ID="SearchBy" onChange="Show()">
<OPTION value="BillingTransit"
>Rollup/Bill To Transit</OPTION>
<OPTION value="Name"
>Name</OPTION>
</SELECT>
<table ID="tblBl_tr" STYLE="display: block "width="488">
<tr>
<td width="269"> Enter Rollup/Bill To Transit:</td>
<td width="176">
<!--webbot bot="Validation" s-data-type="Integer" s-number-separators="," i-maximum-length="5" --><INPUT NAME="BillingTransit" size=18 MAXLENGTH=5></td>
<td width="83"><INPUT TYPE="SUBMIT" VALUE="Submit"></td>
</tr>
</table>
<table ID="tblName" STYLE="display: none"width="558">
<tr>
<td width="225"> Enter Last Name:</td>
<td width="169">
<!--webbot bot="Validation" s-data-type="Integer" s-number-separators="," i-maximum-length="5" --><INPUT NAME="LastName" size=18 MAXLENGTH=5></td>
<td width="150"> </td>
</tr>
<tr>
<td width="225"> Enter First Name:</td>
<td width="169">
<!--webbot bot="Validation" s-data-type="Integer" s-number-separators="," i-maximum-length="5" --><INPUT NAME="LastName" size=18 MAXLENGTH=5></td>
<td width="150"><INPUT TYPE="SUBMIT" VALUE="Submit"></td>
</tr>
</table>
<table ID="tblPh_tr" STYLE="display: none"width="559">
<tr>
<td width="226"> Enter Physical Transit:</td>
<td width="167">
<!--webbot bot="Validation" s-data-type="Integer" s-number-separators="," i-maximum-length="5" --><INPUT NAME="PhysicalTransit" size=18 MAXLENGTH=5></td>
<td width="152"><INPUT TYPE="SUBMIT" VALUE="Submit"></td>
</tr>
</table>
<p align="justify"> </td>
</tr>
</table>
</body>
</html>