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