rendezvous123 Posted November 19, 2006 Share Posted November 19, 2006 This is what i currently have for the JavaScript script.[code]function switch(id, id2, id3){if (document.getElementById){ var obj = document.getElementById(id); var obj2 = document.getElementById(id2); var obj3 = document.getElementById(id3); if (obj2.style.display == "none") { obj.value = "Switch to Content Mode"; obj2.style.display = "block"; obj3.style.display = "none"; } else { obj.value = "Switch to Shout Mode"; obj2.style.display = "none"; obj3.style.display = "block"; }} }[/code]I've been trying to test it using this:[code]<input id="displayer" type="button" value="Switch to Shout Mode" onclick="switch('displayer', 'n1', 'n2')"/><div id="n1" style="display: none;">Shout!</div><div id="n2">Content!</div>[/code]When i click on the button, i want the button's value to change, and the display of both DIV elements to switch. But whenever i click the button, nothing happens. I can't see anything wrong with the script. But, then again, i'm not a JavaScript person. Any help would be appreciated. :D Link to comment Share on other sites More sharing options...
rendezvous123 Posted November 19, 2006 Author Share Posted November 19, 2006 Hah, nevermind. I did not know there was a "switch" function already. I changed names and everything works now. :) Link to comment Share on other sites More sharing options...
Recommended Posts