Jump to content

Show/Hide text


Nudua

Recommended Posts

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

<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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...