このコードのさまざまな表現を試して、コーディング演習のために特定の要素を変更しようとしましたが、ボタンをクリックしたときに要素の複数のスタイルプロパティを変更できるものはないようです。いくつかの支援が大好きです。ありがとう!
document.getElementById("Combo Style").onclick = function() { document.getElementById ("More Text").style.fontSize.color = "50px , #BB65C5"; }
期待される結果を得るには、setAttributeHTMLを使用し
ます。
<button id="Combo Style">Change</button>
<div id="More Text">abcd</div>
JS:
document.getElementById("Combo Style").onclick = function() {
document.getElementById("More Text").setAttribute("style", "font-size:50px;color:red;");
}
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加