Why is this not working in Firefox but works fine in IE
When i click the row on IE it calls the hello() method and works fine but not in Firefox. I'm suspecting this line
tr align="left" bgcolor="eeeeee" style="padding-top: 3px; cursor: pointer;">
because when i remove it it works sort of
<script language="javascript" type="text/javascript">
function hello(){
alert('hello');
}
</script>
<span style="" onclick="hello();"
onmouseover="this.children[0].style.backgroundColor='#D8EEEE'; this.children[1].style.backgroundColor='#D8EEEE';"
onmouseout="this.children[0].style.backgroundCo开发者_开发技巧lor=''; this.children[1].style.backgroundColor='';">
<tr align="left" bgcolor="eeeeee">
style="padding-top: 3px; cursor: pointer;">
<td class="blueFont" style="font-weight: bold; <%=style%>">
I've tried removing the semicolon from onclick already
The HTML is invalid, a <span>
element can't contain <tr>
element. Firefox and Internet Explorer are trying to recover from this in different ways.
IIRC, Internet Explorer will wrap the <tr>
with the <span>
anyway, while Firefox will move the <span>
so it is after the end of the <table>
. As a result, the child element of the span that you are trying to reach doesn't exist.
Start with valid HTML. You can use the <thead>
, <tfoot>
and <tbody>
elements to mark sections of a table.
Because you've got a 'tr' inside a 'span' ?
精彩评论