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?

Link to comment
Share on other sites

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>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.