[Javascript] Dom rollover
diego nunes
dnunes at gmail.com
Thu Sep 28 12:34:10 CDT 2006
On 9/28/06, Guillaume <javascript at webdesignofficina.com> wrote:
> function tooOv() {
> var el = document.getElementById('too');
> if (el.hasChildNodes()) {
> var nodels = el.childNodes;
> for (var i = 0; i < nodels.length; i++) {
> nodels[i].className = 'tooOve';
> };
> };
> }
You could use much more CSS to achieve this, instead of
complicated recursive scripts.
<style>
#textcontainer { color: gray; background: black;}
#textcontainer.hover { color: red; background: white; }
</style>
<div id="textcontainer" onmouseover="this.className='hover';"
onmouseout="this.className='';">
<h2>mimimi</h2>
<p>mimim im imim i mi mi mimimi mimi mi mi</p>
<p>mimim im imim i mi mi mimimi mimi mi mi</p>
<p>mimim im imim i mi mi mimimi mimi mi mi</p>
</div>
Doesn't it works?
--
diego nunes
dnunes.com
More information about the Javascript
mailing list