這里有點搞不懂
?<input type="button" value="改變顏色" onclick="color()"/> ?
function color(){
? ? var a = confirm("是否改變顏色?");
? ? if(a){
? ? ? ?var b = document.getElementById("txt");
? ? ? ?b.style.color="blue";
? ? }
}
我這么寫 ? 怎么彈不出確認(rèn)的對話框?
?<input type="button" value="改變顏色" onclick="color()"/> ?
function color(){
? ? var a = confirm("是否改變顏色?");
? ? if(a){
? ? ? ?var b = document.getElementById("txt");
? ? ? ?b.style.color="blue";
? ? }
}
我這么寫 ? 怎么彈不出確認(rèn)的對話框?
2017-01-05
舉報
2017-01-05
百度一下函數(shù)的命名規(guī)則!你的函數(shù)function color();使用了敏感詞匯color,改成別的試試。
2017-01-05
onClick ? ?C要大寫~