HTML
CSS
JavaScript

javascriptのみでhtmlとcss実装してみた hover編

煩雑さはご愛嬌です

var ul = document.createElement("ul");
nav.appendChild(ul);
var li = new Array(3);
var a = new Array(3);
for(var i=0; i<=3; i++){
li[i] = document.createElement("li");
ul.appendChild(li[i]);
a[i] = document.createElement("a");
a[i].attribute = "href";
a[i].setAttribute("href","");
li[i].appendChild(a[i]);
//hover
li[i].attribute="onmouseover";
li[i].setAttribute("onmouseover", "this.style.backgroundColor='#996633',firstChild.style.color='white'");
li[i].attribute="onmouseout";
li[i].setAttribute("onmouseout", "this.style.backgroundColor='white',firstChild.style.color='#996633'");
}