Note that there are some explanatory texts on larger screens.

plurals
  1. POdate "validation" using javascript
    primarykey
    data
    text
    <p>i hope what i will be posting now will make more sense. so this is the thing i ve been trying to code this in javascript and the same error always occurs, been trying for a while now to figure it out but i can't seem to find the problem.</p> <pre><code>function isLeap(type) { var yr; try{ yr=document.getElementById('yearof' + type).value; try{ yr = parseInt(yr); if ((yr%4) == 0){ if (yr%100 == 0){ if (yr%400 != 0){ alert("Not Leap"); return "false"; } if (yr%400 == 0){ alert("Leap"); return "true"; } } if (yr%100 != 0){ alert("Leap"); return "true"; } } if ((yr%4) != 0){ alert("Not Leap"); return "false"; } } catch(e){ } } catch(e){ break; } } function monthDays(type){ var month; var days; try{ month=document.getElementById('monthof' + type).value; try{ month = parseInt(month); if(month%2 != 0 || month == 8){ days= 31; } else{ if(month != 2){ days = 30; } else{ if(isLeap() == true){ days = 29; } else{ days = 28; } } } var mod=document.getElementById('dayof' + type); for(var i=1; i&lt;13; i++){ var option=document.createElement("option"); option.text=i.toString(); try{ // for IE earlier than version 8 mob.add(option,mob.options[null]); } catch (e){ mob.add(option,null); } } } catch(e){ } } catch(e){ break; } } </code></pre> <p>and this is the html</p> <pre><code>&lt;select id="monthofbirthchild" class="month" name="monthofbirthchild" onchange="monthDays("birthchild")"&gt; &lt;option value="MM"&gt;MM&lt;/option&gt; &lt;/select&gt; &lt;select id="monthofbirth" class="month" name="monthofbirth" onchange="monthDays("birth")"&gt; &lt;option value="MM"&gt;MM&lt;/option&gt; &lt;/select&gt; </code></pre> <p>i am passing either 'birth' or 'birthchild' so that the appropriate either for child or normal can be edited.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload