Witam mam takie coś:

CODE
if (document.getElementById("hasloaw").value != ""){
txt = "";
txt += "<li><a href=' ";
txt += "";
txt += document.getElementById("hasloaw").value;
txt += "' target='_blank'>";
document.getElementById("gen").value += txt;
}

if (document.getElementById("boxartaw").value != ""){
txt = "<img src='";
txt += document.getElementById("boxartaw").value;
txt += "'/></a></li>";
document.getElementById("gen").value += txt;
}








I to generuje mi odpowiednie znaki html po wpisaniu odpowiedniego tekstu do formularza html.

I tu pojawia się moje pytanie jaki kod dopisać do tego dalej aby jak użytkownik nie wpisze nic w pole formularza dodawało też odpowiednią linijkę kodu html?




Sprbowałem tego: zaraz po końcu if


else {

txt += document.write("TEKST").value;
document.getElementById("gen").value += txt;

}


ale nie chce wypisywać do okna "gen" tylko otwiera nowa strone