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);
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