purencool Posted August 20, 2010 Share Posted August 20, 2010 Hi phpfreaks can anyone tell why this if statement won't work? all I want it to do is read the id and the contents inside the td that is called altSwitch and then if it equals 0 then change it to a On <td>Alt</td><td id="altSwitch">0</td> I have tried this <script type="text/javascript"> if (document.getElementById("altSwitch").element.nodeValue=="0"){ document.getElementById("altSwitch").innerHTML="On";} </script> and this <script type="text/javascript"> if (document.getElementById("altSwitch").element.innerHtml=="0"){ document.getElementById("altSwitch").innerHTML="On";} </script> Quote Link to comment Share on other sites More sharing options...
brianlange Posted August 20, 2010 Share Posted August 20, 2010 use firstChild in place of where you have element document.getElementById("altSwitch").firstChild.nodeValue=="0" Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.