I'm making a simple e-mail signature generator. I am a javascript rookie but so far everything is working as it should.
function myFunction() {
document.getElementById("nameinput").innerHTML = document.getElementById("name").value;
document.getElementById("titleinput").innerHTML = document.getElementById("title").value;
document.getElementById("businessunitinput").innerHTML = document.getElementById("businessunit").value;
document.getElementById("groupinput").innerHTML = document.getElementById("group").value;
document.getElementById("departmentinput").innerHTML = document.getElementById("department").value;
document.getElementById("phoneinput").innerHTML = document.getElementById("phone").value;
document.getElementById("mobileinput").innerHTML = "<strong>M: </strong>" + document.getElementById("mobile").value;
if(document.getElementById("mobile").value == "")
{
document.getElementById("mobileinput").innerHTML = "";
}
document.getElementById("emailinput").innerHTML = document.getElementById("email").value;
document.getElementById("addressinput").innerHTML = document.getElementById("address").value;
document.getElementById("cityinput").innerHTML = document.getElementById("city").value;
document.getElementById("postalinput").innerHTML = " | " + document.getElementById("postal").value;
if(document.getElementById("postal").value == "")
{
document.getElementById("postalinput").innerHTML = "";
}
if(document.getElementById("website").checked)
{
document.getElementById("websiteinput").innerHTML = "iron helps us play";
}
}
Except for the last part. I cant work out how to change the text of "websiteinput" when the checkbox "website" is selected. What am I doing wrong? Again, here is the code in question-
if(document.getElementById("website").checked)
{
document.getElementById("websiteinput").innerHTML = "iron helps us play";
}
Aucun commentaire:
Enregistrer un commentaire