Jump to content

[SOLVED] If Statement Help??


mikey3521

Recommended Posts

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>

 

 

Link to comment
https://forums.phpfreaks.com/topic/137609-solved-if-statement-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.