Arindam Das Arindam Das - 1 month ago 12
Javascript Question

Why <td> onclick event not firing in asp.net?

I have a

<td>
, clicking on that I want display a
div


here's my code:

<td id="tdmord" style="padding-left: 15px; color: #86A7C5; padding-right: 15px; font family: Arial;
font-size: small;" onclick="return showdiv1()">
My Orders
</td>


and here's the JavaScript:

function showdiv1 {
document.getElementById("divmo").style.display="block";
return false;
}


the problem is the
<td>
is not clickable and I can't click on it.

Answer

your showdiv1 is missing this ()

define showdiv1() like this:

<script type="text/javascript">
   function showdiv1()   {
      document.getElementById("tdmord").style.display="block";
       alert('s');
       return false; 
}
</script>

also Id that your function showdiv1 is using is wrong. correct that!!!

Comments