0
使用javascript,我希望我的複選框更改輸入文本字段的文本修飾。 所以當它被選中時,輸入文本字段中的文本變成粗體。複選框更改文本裝飾輸入字段
記住我學習,所以我不親,你的傢伙;)
我想是這樣的;
var checkbox = create("input");
checkbox.type = "checkbox";
checkbox.id = "checkboxId" + counter;
div.appendChild(checkbox);
checkbox.onClick="boldChange(this)"
var input = create("input");
input.type = "input";
input.id = "inputId" + counter;
div.appendChild(input);
function boldChange()
var boldgroup = document.getElementsByName(el.name);
for (var b=0; boldgroup[b]; ++b)
inputId.style.textDecoration = boldgroup[b].checked ? 'bold' : 'none';
}
我該如何做這項工作? 非常感謝你提前
` text-decoration:bold`是無效的CSS,IIRC – 2010-12-06 17:54:11