Jump to content

[SOLVED] Changing the text in a <p> tag more than once


pleek

Recommended Posts

ok so i have this part on my website that i have writting to collaps the shout box. The script works perfectly but i wan the plus and minus words and pics to replace themselves when u click on them

 

I got the text and pic to replace once but i can't get it to change to the other text and pic every time u click it

 

my code is

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<HTML>
<HEAD>
<TITLE>Untitled</TITLE>
<script type="text/javascript">

function hide()
{
document.getElementById("PAR").innerHTML =
	"<a href='javascript: void(0)'><IMG SRC='plus.GIF' WIDTH='10' HEIGHT='10'> Show Shout Box</a>" 
}

</script>

</HEAD>

<BODY>
<p id="PAR" onclick="hide()">
  <a href="javascript: void(0))"><IMG SRC="minus.gif" WIDTH="10" HEIGHT="10"> Hide Shout Box</a>
</p>


</a>
</BODY>
</HTML>

 

this works fine the first time but i don't know how to make it change everytime u click on it, Can somebody help me out here?

try this:

 


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<HTML>
<HEAD>
<TITLE>Untitled</TITLE>
<script type="text/javascript">

function hide()
{
document.getElementById("PAR").innerHTML =
	"<a href='javascript: void(0)' onclick='show()'><IMG SRC='plus.GIF' WIDTH='10' HEIGHT='10'> Show Shout Box</a>" 
}
function show()
{
document.getElementById("PAR").innerHTML =
	"<a href='javascript: void(0)' onclick='hide()'><IMG SRC='minus.GIF' WIDTH='10' HEIGHT='10'> Hide Shout Box</a>" 
}

</script>

</HEAD>

<BODY>
<p id="PAR" onclick="hide()">
  <a href="javascript: void(0))"><IMG SRC="minus.gif" WIDTH="10" HEIGHT="10"> Hide Shout Box</a>
</p>

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.