Page is a not externally linkable
- Code, Content, and Presentation
-- JavaScript and AJAX
---- OnClick Issue


MarkFilipak - 4:36 am on Aug 5, 2012 (gmt 0)


Your problem is that the comparison should be if (divid=="dpsheal") ...note: == is a comparison, = is an assignment. Also, you're using getElementById, but you don't have an id attribute for the input elements.

That written, I'd do your code like this:

<input type="radio" name="spell_type" value="dpsheal" onClick="toggleVisibility(this);" /> DPS/Heal
<input type="radio" name="spell_type" value="buff" onClick="toggleVisibility(this);" /> Buff

<script type="text/javascript">
function toggleVisibility(element)
{
var isVisible = (element.style.visibility == "visible");
if (isVisible) element.style.visibility = "hidden";
else element.style.visibility = "visible";
}
</script>


Thread source:: http://www.webmasterworld.com/javascript/4481931.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com