1
我正在使用如下所示的setAttribue
。它的工作只爲第一時間和之後的變化值顯示alert
但與document.getElementById("to").setAttribute("value", selValue);
setAttribute在JavaScript中不工作
document.getElementById("listcontact").onchange = function() {
var selIndex = document.getElementById("listcontact").selectedIndex;
var selValue = document.getElementById("listcontact").options[selIndex].innerHTML;
var contactVal = selValue.split(';');
var phone = contactVal[2];
alert(phone);
document.getElementById("to").setAttribute("value", selValue);
selIndex = "";
selValue = "";
phone = "";
selValue = "";
};
設置這是爲什麼不工作,我希望,我該如何解決?
嗨昆汀,工作完美。解決了我的問題。謝謝!花花公子。 –