css - JavaScript: Change Class Style across various pages -


i trying create function allow me change color of div in footer on every page on mouseover.

this have come far , not working.

javascript:

function a(obj) {     var elements = document.getelementsbyclassname(obj)     var objects = []      (var i=0; < elements.length; ++i) {         objects.push(elements[i])     }     return objects; }  var footerdiv = a('footerdiv'); footerdiv.onmouseover = function() {     footerdiv.style.color = 'black'; }  footerdiv.onmouseout = function() {     footerdiv.style.color = 'white'; } 

html:

<div class="footerdiv">   example text </div>  

i'd css:

.footerdiv {     color: white; }  .footerdiv:hover {     color: black } 

Comments

Popular posts from this blog

c++ - llvm function pass ReplaceInstWithInst malloc -

java.lang.NoClassDefFoundError When Creating New Android Project -

Decoding a Python 2 `tempfile` with python-future -