Hi everyone, I am proud of myself, I am finally finish. It took me too weeks working with this day and night, but I am finally finish. The only thing is that I have a bug in my code.
I have a getbyelement section that has the visibility to be shown when CreditCardInfo is true. It works fine when I click on credit card but the problem is that it does NOT hide when I click on other selections beside credit card.
Therefore, I tried this and the credit card selection is still displaying even when I choose another option like check or cash.
function CheckForCreditCard(el)
{
if (el.options[2].selected == true)
{
var CreditCardInfo = document.getElementById("CreditCardInfo");
CreditCardInfo.style.visibility = "visible";
}
else
if (el.options[2].selected == false)
CreditCardInfo.style.visibility = "hidden";
}
<strong>Payment:</strong>
<select name="selPayment" onchange="CheckForCreditCard(this);">
<option value="Cash" selected="selected">Cash</option>
<option value="Check">Check</option>
<option value="Credit Card" >Credit Card</option>
</select>
<div id="CreditCardInfo"> <br />
Card Number:
<input name="selCreditCardInfo" size="20" type="text" /> Month:
<input type="text" name="txtMonth" size="4" /> Year:
<input name="txtYear" size="4" type="text" />
</div>