deste wrote:
Quote:
Hi folks!
>
I've got a problem with javascript and DOM.
I want to create a simple "intelligent" <table>, inside a data-form.
I'd like to do:
- Change color of any <tron onMouseOver DOM event;
Capitalisation is often used in HTML markup, however I find it
misleading. In script you must write onmouseover, so better to use the
same in the HTML. Just a personal preference of course... :-)
Quote:
- Check a checkbox on click on a <trand change <trbackground color.
>
Do you ever use phpMyAdmin? Well, the effect i'd like to get it's the
same that it's used in phpMyAdmin's tables. I try to look at phpMyAdmin
source code... But it's too difficult for me. ;-)
>
Let me show you my simple example file (in php format)...
Don't post server code, keep that for a php group. Post what your
browser actually receives, once you sort that out, how you get it there
is up to you.
[...]
Quote:
<script type="text/javascript">
<!--
Don't use HTML comment delimiters inside script tags, they are useless
and likely to cause problems (though not in this case).
[...]
Quote:
>
With Firefox it works fine; but it doesn't work with Internet Explorer!
IE seems to don't use javascript functions in DOM events of <trtag:
A notion that is easily disproved:
<table><tr onmouseover="alert('hey');"><td>blah</table>
Quote:
I
try to set only .style.background-color in "onMouseOut" and other
You should be setting: style.backgroundColor. When using CSS
properties in javascript, hyphenated names must be converted to
"camelCase".
Quote:
events... It work!
So it does work? I'm confused.
Quote:
>
I don't understand why this... Maybe I can't use these DOM events on
<trtag? Or I mistake something?
Yes, you can.
Quote:
>
Please, try to help me if you can!
If you post what your browser is actually getting (e.g. using view
source or the generated source), then more help can be offered.
Othewise you are asking someone to load your PHP on a server and
deliver it to a browser to debug, or be a sufficiently good PHP
developer that they can see the bugs in the code. Count me out!!!!
:-)
Quote:
In alternative, do you know another way to do my tables?
I think your approach using CSS classes is the best one. While the
:hover pseudo-class is supported by a wide variety of browsers, it
isn't supported by IE<7, so script is your only option:
<head>
<title>tr play</title>
<style type="text/css">
.blue {background-color: #ddddff;}
.pink {background-color: #ffdddd;}
</style>
</head>
<table>
<tr onmouseover="this.className='blue';"
onmouseout="this.className='pink';">
<td>blah</td>
</tr>
</table>
--
Rob