misiek172
14.10.2008, 12:35:54
Witam.
Od rana walczę w pewnym głupim problemem , mianowicie:
napisałem sobie skrypt generujący mi selecty z datą, wybiera sie dzień miesiąc i rok, wszystko ok pod IE i FF ładnie się wyświetla SELECT (robie to za pomocą appendChild) tylko problem jest taki że po wysłaniu formularza w tablicy _POST są dane ale tylko gdy wysyłam pod FF, jak wyśwle pod IE to selecty mają puste wartości...
dlaczego tak jest?
Pozdrawiam, Łukasz.
wookieb
14.10.2008, 12:40:29
A może byś łaskawco pokazał kod?
misiek172
16.10.2008, 15:13:34
ale co mam ci pokazywac

createElement
potem atrybuty
i appendChild do diva

a taki kodzik:
<?php
function day(v){
for(var y=1;y<=31;y++){
var theOption=d.createElement("OPTION");
theText=d.createTextNode(y<10?'0'+y:y);
theOption.appendChild(theText);
v.appendChild(theOption);
}
v.options[--Day].selected = true;
//v.options.selectedIndex = 2;
}
function month(v){
var Day = today.getMonth();
for(var y=1;y<=12;y++){
var theOption=d.createElement("OPTION");
theText=d.createTextNode(y<10?'0'+y:y);
theOption.appendChild(theText);
v.appendChild(theOption);
}
v.options[Day].selected = true;
}
function year(v){
var Day = today.getFullYear();
for(var y=Day;y>=2007;y--){
var theOption=d.createElement("OPTION");
theText=d.createTextNode(y<10?'0'+y:y);
theOption.appendChild(theText);
v.appendChild(theOption);
}
}
function createDataSelect(name)
{
var v=d.createElement('select');
v.setAttribute('name',name+i);
switch (i)
{
case 0 : day(v); break;
case 1 : month(v); break;
case 2 : year(v); break;
}
theText=d.createTextNode(' - ');
var divek = document.getElementById(name);
divek.appendChild(v);
if(i!=2)
divek.appendChild(theText);
i++;
if(i<3){
createDataSelect(name);
}else{
i = 0;
done = 1;
}
}
?>
edit:
ok dodałem atrybut value dla option'ów i działa elegancko pod IE, pozdr.