TheCandyman
Technical User
I'm trying to get this javascript to work when the drop down menu changes to pull a description and display it(splitString[3]). But i keep getting an error and no text. I made a message box to make sure my values where correct and i do need to display splitString[3] in Div 'thursdesc'. Where did i go wrong?
My Error:
document.getElementById(sDay + "thursdesc") has no properties
My Error:
document.getElementById(sDay + "thursdesc") has no properties
Code:
<script language="JavaScript" type="text/JavaScript">
function updateinfo(sDay, iEventString, iQuant){
if ( iEventString =="0"){
document.getElementById(sDay + "div").innerHTML = "";
document.getElementById(sDay + "subtot").innerHTML = "";
//document.getElementById(sDay + "availdiv").innerHTML = "";
}
else {
var myString = new String(iEventString);
var splitString = myString.split(':');
document.getElementById(sDay + "div").innerHTML = "$" + splitString[1] + ".00";
document.getElementById(sDay + "subtot").innerHTML = "$" + (splitString[1] * iQuant) + ".00";
document.getElementById(sDay + "thursdesc").innerHTML = splitString[3];
};
};
</script>
Code:
<tr>
<td align="center" bgcolor="#E0E0E0" width="64"><span class="style12">Thurs</span> </td>
<td height="30" align="center" width="319"> <select name="thursevent" id="thursevent" style="width:320px" onChange="updateinfo('thurs', this.value, document.modform.thursquant.value);" >
<option value="0"> -- Please Select a Thursday Event to Attend -- </option>
<option value="168:100:36:Description Text Goes Here"> 1:30pm - Advanced Composite Veneers (must attend a.m. lecture)</option>
<option value="181:20:50:">2:00pm - Biolase Workshop (AM lecture required)</option> <option value="184:10:0:" style='color: #FF0000'>11:00am - ** SOLD OUT ** Box Lunch on the Exhibit Floor</option>
</select></td>
<td colspan="3" rowspan="2" height="30">Desc: <div name="thursdesc" id="thursdesc"></div></td>
<td align="center"><input name="Add1" type="button" id="Add1" onClick="addevent(document.modform.thursevent.value, document.modform.thursquant.value, document.modform.thursdesc.value);" value="Add This Event" style="font-family: Tahoma; font-size: 12px" /></td>
</tr>
<tr>
<td align="left" colspan="3">
<table width="400" border="0" cellspacing="2" cellpadding="0">
<tr>
<td width="25%"> </td>
<td width="25%" align="center"><strong>Price:</strong> <div class="style1" id="thursdiv">$0.00</div></td>
<td width="25%" align="center"><strong>Quanity:</strong>
<select name="thursquant" id="thursquant" onChange="updateinfo('thurs', document.modform.thursevent.value, this.value)">
<option selected value="1" >1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
</select></td>
<td width="25%" align="center"><strong>Subtotal:</strong><div class="thurssubtot" id="thurssubtot">$0.00</div></td>
</tr>
</table>
</td>
</tr>