mikey3521 Posted December 18, 2008 Share Posted December 18, 2008 Ok below is the code I have thusfar, I need to make it toggle. So IF the classname = Viewable then i want to set it to hidden, and visa versa... <script type="text/javascript" language="JavaScript"> <!-- function toggleDiv(idname) { document.getElementById(idname).className = "hidden"; return false; } --> </script> So now I've got this: <script type="text/javascript" language="JavaScript"> <!-- function toggleDiv(idname) { if (document.getElementById(idname).className = "viewable") { document.getElementById(idname).className = "hidden"; return false; } else if (document.getElementById(idname).className = "hidden") { document.getElementById(idname).className = "viewable"; return false; } } --> Now I think the problem is with my actual IF question, I don't know how to return just the name of a div class. any thoughts? </script> Quote Link to comment https://forums.phpfreaks.com/topic/137609-solved-if-statement-help/ 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.