Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> appendChild i tablica _POST
misiek172
post
Post #1





Grupa: Zarejestrowani
Postów: 656
Pomógł: 3
Dołączył: 26.10.2005
Skąd: Częstochowa

Ostrzeżenie: (0%)
-----


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.
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 2)
wookieb
post
Post #2





Grupa: Moderatorzy
Postów: 8 989
Pomógł: 1550
Dołączył: 8.08.2008
Skąd: Słupsk/Gdańsk




A może byś łaskawco pokazał kod?
Go to the top of the page
+Quote Post
misiek172
post
Post #3





Grupa: Zarejestrowani
Postów: 656
Pomógł: 3
Dołączył: 26.10.2005
Skąd: Częstochowa

Ostrzeżenie: (0%)
-----


ale co mam ci pokazywac (IMG:http://forum.php.pl/style_emoticons/default/biggrin.gif)

createElement

potem atrybuty

i appendChild do diva (IMG:http://forum.php.pl/style_emoticons/default/smile.gif)

a taki kodzik:

  1. <?php
  2. function day(v){
  3.    var Day = today.getDate();
  4.    for(var y=1;y<=31;y++){
  5.        var theOption=d.createElement("OPTION");
  6.        theText=d.createTextNode(y<10?'0'+y:y);
  7.        theOption.appendChild(theText);
  8.        v.appendChild(theOption);
  9.    }
  10.    v.options[--Day].selected = true;
  11.    //v.options.selectedIndex = 2;
  12. }
  13. function month(v){
  14.    var Day = today.getMonth();
  15.    for(var y=1;y<=12;y++){
  16.        var theOption=d.createElement("OPTION");
  17.        theText=d.createTextNode(y<10?'0'+y:y);
  18.        theOption.appendChild(theText);
  19.        v.appendChild(theOption);
  20.    }
  21.    v.options[Day].selected = true;
  22. }
  23. function year(v){
  24.    var Day = today.getFullYear();
  25.    for(var y=Day;y>=2007;y--){
  26.        var theOption=d.createElement("OPTION");
  27.        theText=d.createTextNode(y<10?'0'+y:y);
  28.        theOption.appendChild(theText);
  29.        v.appendChild(theOption);
  30.    }
  31. }
  32. function createDataSelect(name)
  33. {
  34.    var v=d.createElement('select');
  35.    v.setAttribute('name',name+i);
  36.    
  37.    switch (i)
  38.    {
  39.        case 0 : day(v); break;
  40.        case 1 : month(v); break;
  41.        case 2 : year(v); break;
  42.    }
  43.  
  44.    theText=d.createTextNode(' - ');
  45.    var divek = document.getElementById(name);
  46.    divek.appendChild(v);
  47.    if(i!=2)
  48.        divek.appendChild(theText);
  49.    i++;
  50.    if(i<3){
  51.        createDataSelect(name);
  52.    }else{
  53.        i = 0;
  54.        done = 1;
  55.    }
  56.  
  57. }
  58. ?>


edit:

ok dodałem atrybut value dla option'ów i działa elegancko pod IE, pozdr.


Ten post edytował misiek172 17.10.2008, 11:04:34
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 22.08.2025 - 23:39