私はこのように私のページでJavascriptを使用してDOMで要素を作成しています
var myTd_1 = document.createElement("td")
それらにプロパティを追加すると、
myTd_1.width='25%'
myTd_1.padding = '6'
onMouseOverイベントとonMouseOutイベントを使用する場合に備えて、TDに異なる背景色を追加したいと思います。
どうすればいいですか?
ネットで探してみましたが、本当に必要なものが見つかりませんでした。
私が知っているものを使用して私が思いついた最も近いものは:
myTd_1.onMouseOver = 'this.style.backgroundColor="#042b2b"'
myTd_1.onMouseOut = 'this.style.backgroundColor="transparent"'
しかし、それは機能していません:(