Nudua Posted January 21, 2007 Share Posted January 21, 2007 HiTrying to do some javascript magic here, but can't get it to work. What I want is that when someone push the link "Vis Resultater >>" then some divs/coding shows up under. And if possible, gets hidden the second time someone push the link. <a href="#" id="showResult">Vis resultater >></a><div id="result" style="display: none"><p>Testing</p></div <!-- #result --> So, when someone press "Vis resultater >>" then I want the div#result to show. Link to comment Share on other sites More sharing options...
javalessons Posted January 22, 2007 Share Posted January 22, 2007 Something likedocument.getElementById("result").style.visibility='hidden';or ...'visible'.should do the trick. Link to comment Share on other sites More sharing options...
jesh Posted January 22, 2007 Share Posted January 22, 2007 <script type="text/javascript">function toggle(id){ var obj = document.getElementById(id); if(obj.style.display == "block") { obj.style.display = "none"; } else { obj.style.display = "block"; } // return false here so that the link doesn't try to send // the visitor to whatever is in the href of the link when // s/he clicks on it. return false;}</script><a href="#" id="showResult" onclick="toggle('result');">Vis resultater >></a><div id="result" style="display: none"><p>Testing</p></div <!-- #result --> Link to comment Share on other sites More sharing options...
Nudua Posted January 22, 2007 Author Share Posted January 22, 2007 Big thanks to both of you, got it working now. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now