I keep getting the error 'value' is null or not an object.
Why is this?
I can get this alert to popup
Code:
alert("checkChdBirthday");
but then get the error
Code:
<script language="javascript">
///////////////////////////////
// Check the CHILD Birthday //
// 12 Year Old Check //
///////////////////////////////
function checkChdBirthday(obj)
{
alert("checkChdBirthday");
if( !/^(\d{1,2})(\d{1,2})(\d{4})$/.test(obj.value) ) {
alert( "Invalid date supplied - must be format DDMMYYYY" );
return;
}
var d = new Date();
var d2 = new Date(RegExp.$3, RegExp.$2, RegExp.$1);
var diff = d.getDiff(d2, "y")
alert (diff);
if( isNaN(diff) ) {
alert( "Invalid date supplied" );
}
else if( diff < 12 ) {
alert( "This IS an CHILD \n they are younger that 12" );
child = true;
submit_form=true;
}
else if( diff > 12 ) {
alert( "This is NOT an CHILD \n they are older that 12" );
child = false;
alert(document.form.nochd.value);
for (i=1; i<document.form.nochd.value; i++)
{
document.form.chdbirthday[i].value = "";
document.form.chddate[i].focus();
submit_form=false;
}
}
}
</script>
<%
noc = 2
for j=1 to noc
%>
<select name="chddate<%=j%>"
onChange="document.form.chdbirthday<%=j%>.value=document.form.chdbirthday<%=j%>.value+document.form.chddate<%=j%>.options[document.form.chddate<%=j%>.selectedIndex].value;"
style="color: black; font: 7pt Verdana, Arial, Helvetica, sans-serif;">
<%
Response.write "<option> --- </option>"
For d = 1 to 31
Response.write "<option value=" & d & ">" & d & "</option>"
Next
%>
</select>
<select name="chdmonth<%=j%>"
onChange="document.form.chdbirthday<%=j%>.value=document.form.chdbirthday<%=j%>.value+document.form.chdmonth<%=j%>.options[document.form.chdmonth<%=j%>.selectedIndex].value;"
style="color: black; font: 7pt Verdana, Arial, Helvetica, sans-serif;">
<%
Response.write "<option> --- </option>"
For m = 1 to 12
response.Write "<option value=" & m & ">" & MMtoMMM(m) & "</option>"
Next
%>
</select>
<%
Dim vor_15_jahren
vor_15_jahren = year(date) - 15
%>
<select name="chdyear<%=j%>"
onChange="document.form.chdbirthday<%=j%>.value=document.form.chdbirthday<%=j%>.value+document.form.chdyear<%=j%>.options[document.form.chdyear<%=j%>.selectedIndex].value;"
style="color: black; font: 7pt Verdana, Arial, Helvetica, sans-serif;">
<%
Response.write "<option> --- </option>"
For y = vor_15_jahren to year(date)
Response.Write "<option value=" & y & ">" & y & "</option>"
Next
%>
</select>
<input type="text" name="chdbirthday<%=j%>" size="5" style="font:7pt;" maxLength="10">
<% next %>
<img src="images/confirm.gif"
onclick="javascript: checkChdBirthday(document.form.chdbirthday); confirmedok();">
www.crmpicco.co.uk
www.crmpicco.co.uk.tt
www.milklemonadechocolate.uk.tt
www.griswolds.uk.tt
www.piccosmini.co.uk.tt
www.morton.uk.tt