www.webdeveloper.com
Results 1 to 4 of 4

Thread: Easy style backgroundColor thing

  1. #1
    Join Date
    Feb 2012
    Posts
    2

    Easy style backgroundColor thing

    hey guys.
    why this doesn't work, i would be glad if u helped.

    <script type="text/javascript">

    function boja(par)
    {
    switch (par)
    {
    case "in":
    document.getElementById("person").style.backgroundColor='yellow';
    case "out":
    document.getElementById("person").style.backgroundColor='lightblue';
    }
    }
    </script>

    <td width="133" id="person" style="background-color:lightblue" onmouseover="javascript:boja('in')" onmouseout="javascript:boja('out')">Особа</td>

    Thanks a lot.
    bye,nick.

  2. #2
    Join Date
    Feb 2012
    Posts
    218
    Don't forget to use break; after each case
    Code:
    case "in":
    	document.getElementById("person").style.backgroundColor='yellow';
    	break;
    case "out":
    	document.getElementById("person").style.backgroundColor='lightblue';
    	break;

  3. #3
    Join Date
    Nov 2010
    Posts
    1,090
    dunno why you need the function at all...

    Code:
    <html>
    <head>
    <body>
    <table>
    <td width="133" id="person" style="background-color:lightblue" onmouseover=this.style.backgroundColor='yellow' onmouseout=this.style.backgroundColor='lightblue'>O6o6a</td>
    </table>
    </body>
    </html>

  4. #4
    Join Date
    Feb 2012
    Posts
    2
    hey, thank u guys both.

    (dumn , me stupid...
    cya

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles