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.
You are missing ()
for showdiv1
function showdiv1() {
document.getElementById("tdmord").style.display="block";
return false;
}
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!!!
Working code , There is no need to create extra function for it.
<table>
<tr>
<td onclick="document.getElementById('abc').style.display='block';">change color</td>
</tr>
</table>
<div id="abc" style="display:none;">
pranay
</div>
Error in you code you missed () , updated code is
function showdiv1() {
document.getElementById("divmo").style.display="block";
return false;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.