Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [js] Dynamicznie tworzony formularz, Pod FF i Operą działa pod IE nie
windman
post 19.06.2008, 20:03:52
Post #1





Grupa: Zarejestrowani
Postów: 184
Pomógł: 13
Dołączył: 7.01.2008

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


Witam,

Tworzę formularz dynamicznie:

Kod
   //formularz
   var objLetKnowForm = document.createElement("form");
   objLetKnowForm.setAttribute('name','letknowform');
   objLetKnowForm.setAttribute('method','get');
   objLetKnowForm.onsubmit = function(){return false;}
   objLetKnow.appendChild(objLetKnowForm);  
  
   //Input nadawca
   var objLetKnowNadawca = document.createElement("input");
   objLetKnowNadawca.setAttribute('type','text');
   objLetKnowNadawca.setAttribute('name','nadawca');
   objLetKnowNadawca.setAttribute('value','Twój e-mail');
   objLetKnowNadawca.onfocus = function () {if(this.value=='Twój e-mail') this.value=''}
   objLetKnowForm.appendChild(objLetKnowNadawca);
  
   //Input button
   var objLetKnowButton = document.createElement("input");
   objLetKnowButton.setAttribute('type','submit');
   objLetKnowButton.setAttribute('name','letknowbutton');
   objLetKnowButton.setAttribute('value','Powiadom');
   objLetKnowButton.onclick = function(){alert(document.letknowform.nadawca.value); return false;}
   objLetKnowForm.appendChild(objLetKnowButton);


Pod FF i Operą alert zwraca zawartośc pola nadawca, natomiast IE wyświetla błąd: document.letknowform.nadawca jest pusty lub nie jest obiektem.

Ktoś ma pomysł dlaczego?
Pozdrawiam
Go to the top of the page
+Quote Post

Posty w temacie


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

 



RSS Wersja Lo-Fi Aktualny czas: 19.07.2025 - 18:24