If you see my last post, it was a piece of this code that I was learning for/loops but now I have that all working(hence the new topic) and I'm having a problem with indexOf
Here's the whole script(its a fun little date picker)
function popSel(v){
var days;
var x;
if(v==01 || v==03 || v==05 || v==07 || v==08 || v==10 || v==12){
x = 31;
}else if(v==04 || v==06 || v==09 || v==12){
x = 30;
}else if(v==02){
/*var yr=document.getElementById("year").value / 4;*/
var yr = 2003 / 4;
if(yr.indexOf(".") == -1){ /*If you divide a year by 4 and the value is a whole number, it's a leap year*/
x=28;
}else{
x=29;
}
}
for(i = 1; i <= x; i++){
days += "<option value=" + i + ">" + i + "</option>";
}
document.getElementById("day").innerHTML=days;
}
The whole script works but feb doesn't change -- any thoughts? As always, thanks in advance!!!

New Topic/Question
Reply



MultiQuote




|