views:

28

answers:

1

I have the following HTML:

   <tr id="n16">
    <td class="t_row">Text <a href="#" onClick="javascript:notification_dismiss('16');">Dismiss</a></td>
   </tr>

I want to update my database and hide the TR when people click Dismiss. Updating the database is working fine, but the TR won't hide. I have this JS:

function stateChanged(str)
{
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 {
 document.getElementById("n" & str).display = 'none'
 }
}

I need to dynamically pass the TR's ID to the JS (using the "str" variable), but that part doesn't seem to be working. Any ideas why?

+5  A: 

You're using the binary & operator for string concatenation. You need to use +.

document.getElementById("n" & str).display = 'none';
//                          ↑ change this character to `+`
Andy E