ARTLUNG LAB Share

1999

onMouseover in a TR tag

Don't use this technique.

hello world
hola mundo
hello hello
hola mundo
the tr for this row has an onmouseover alert()

HTML & JavaScript

    <table cellspacing="0" cellpadding="3" border="1">
        <tr onmouseover="this.className='yellowThing';"
            onmouseout="this.className='whiteThing';">
            <td>hello</td>
            <td>world</td>
        </tr>
        <tr onmouseover="this.className='yellowThing';"
            onmouseout="this.className='whiteThing';">
            <td>hola</td>
            <td>mundo</td>
        </tr>
        <tr onmouseover="this.className='yellowThing';"
            onmouseout="this.className='whiteThing';">
            <td>hello</td>
            <td>hello</td>
        </tr>
        <tr onmouseover="this.style.background='#F00';"
            onmouseout="this.style.background='#FFF';">
            <td>hola</td>
            <td>mundo</td>
        </tr>
        <tr onmouseover="alert('hello onmouseover');"
            class="pinkThing">
            <td>the tr for this row has</td>
            <td>an onmouseover <code>alert()</code></td>
        </tr>
    </table>

    <style type="text/css">
        .yellowThing {
            background: #FF9;
        }

        .whiteThing {
            background: #FFF;
        }

        .pinkThing {
            background: pink;
        }

    </style>