UPDATE: id="gender"
追加して、最初にonchange="updateMaritalStatus(this)"
は、オンロード/のonchange
function updateMaritalStatus(o){
var gen = document.getElementById("gender"), marital_status = "";
if(o){
marital_status = o.value == "m" ? " widower" : "widow"
}else{
marital_status = gen.selectedIndex == 0 ? "widower" : "widow";
}
document.getElementById("marital").lastChild.text = marital_status;
}
アドオンのために1行に
<select id="marital"><option>Unmarried</option><option>Married</option><option>Divorced</option><option>Widow</option></select>
機能を第2の選択オプションを保つ
<select id="gender" onchange="updateMaritalStatus(this)">
を選択onload
ちゃん未亡人/寡婦
window.onload = function(){updateMaritalStatus()};
「寡婦」を使用してください。ジェンダーに中立的であるだけでなく、文法的に他の選択、未婚、結婚、離婚と一貫しています。これらはすべての状態(形容詞または厳密に言えば分詞)ですが、未亡人/寡婦は名詞です。 – Verbeia
@Verbeia、そうです。しかし、私は質問がとにかく技術的な答えを保証すると思います。 – Anthony