Solved

Simple Show/Hide issue

Posted on 2011-09-22
3
257 Views
Last Modified: 2012-05-12
I've got the script below written and functioning expect for this issue:

Choose the last bullet.  Line 5 appears as it should.
Now choose any other bulleted line. Unfortunatly that also appears with Line 5.

Goal is to get all the Lines to appear one by one. This seems to only be happening with the Line 5 item.
 
I had this problem once before and I know it's simple but just cant recall what I did for it.
Any assitance is much appreciated.

Thank You
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
<script>


function hideall(){
  for (count=1; count<5; count+=1) // set "count" to one more than the total images/links
  document.getElementById('box'+count).style.display='none'; 
    }


function showbox(box){
  document.getElementById(box).style.display='block';




}

  </script>
</head>

<body>
	<ul>
					<li><a href="#" onclick="hideall();showbox('box1')">
					<font face="Arial">
					<font size="2">What transactions are affected?<br></li>
					
					<li><a href="#" onclick="hideall();showbox('box2')">
					<font face="Arial">
					<font size="2">How do I register my NPI?<br></li>
					
					<li><a href="#" onclick="hideall();showbox('box3')">
					<font face="Arial">
					<font size="2">How do I verify if my NPI is registered with Aetna?<br></li>
					
					<li><a href="#" onclick="hideall();showbox('box4')">
					<font face="Arial">
					<font size="2">Does the NPI replace the Tax ID number?<br></li>
					
					<li><a href="#" onclick="hideall();showbox('box5')">
					<font face="Arial">
					<font size="2">Are providers allowed to send other identification numbers, such as PIN, PVN, and TIN, in electronic transactions?</li>
					</ul>
						</td>
					</tr>
				</table>

				</td>
				<td bgcolor="#FFFFFF">
<p style="margin-top: -2px" align="center"><font size="5" face="Arial">Answers Here</font></p>
<hr color="#003366">
<p>
<div id="Content1" style="width: 623px; height: 433px">
<div id="box1" style="display: none"><font face="Arial" size="2"><b>Line1</b></font></div>
<div id="box2" style="display: none"><font face="Arial" size="2"><b>Line2</b></font></div>
<div id="box3" style="display: none"><font face="Arial" size="2"><b>Line3</b></font></div>
<div id="box4" style="display: none"><font face="Arial" size="2"><b>Line4</b></font></div>
<div id="box5" style="display: none"><font face="Arial" size="2"><b>Line 5</b></font></div>
</body>

</html>

Open in new window

0
Comment
Question by:jscripter1138
  • 2
3 Comments
 
LVL 63

Accepted Solution

by:
Zvonko earned 500 total points
Comment Utility
You missed:
  count<=5;
0
 

Author Closing Comment

by:jscripter1138
Comment Utility
Another set of eyes always helps.... Thank you
0
 
LVL 63

Expert Comment

by:Zvonko
Comment Utility
And I do that show/hide thing like this:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Zvonko &#42;</title>
<script>
var divShow;
function showbox(box){
  if(divShow) divShow.style.display='none';
  divShow = document.getElementById(box);
  divShow.style.display='block';
}
</script>
</head>
<body>
	<ul>
					<li><a href="#" onclick="showbox('box1')">
					<font face="Arial">
					<font size="2">What transactions are affected?<br></li>
					
					<li><a href="#" onclick="showbox('box2')">
					<font face="Arial">
					<font size="2">How do I register my NPI?<br></li>
					
					<li><a href="#" onclick="showbox('box3')">
					<font face="Arial">
					<font size="2">How do I verify if my NPI is registered with Aetna?<br></li>
					
					<li><a href="#" onclick="showbox('box4')">
					<font face="Arial">
					<font size="2">Does the NPI replace the Tax ID number?<br></li>
					
					<li><a href="#" onclick="showbox('box5')">
					<font face="Arial">
					<font size="2">Are providers allowed to send other identification numbers, such as PIN, PVN, and TIN, in electronic transactions?</li>
					</ul>
						</td>
					</tr>
				</table>
				</td>
				<td bgcolor="#FFFFFF">
<p style="margin-top: -2px" align="center"><font size="5" face="Arial">Answers Here</font></p>
<hr color="#003366">
<p>
<div id="Content1" style="width: 623px; height: 433px">
<div id="box1" style="display: none"><font face="Arial" size="2"><b>Line1</b></font></div>
<div id="box2" style="display: none"><font face="Arial" size="2"><b>Line2</b></font></div>
<div id="box3" style="display: none"><font face="Arial" size="2"><b>Line3</b></font></div>
<div id="box4" style="display: none"><font face="Arial" size="2"><b>Line4</b></font></div>
<div id="box5" style="display: none"><font face="Arial" size="2"><b>Line 5</b></font></div>
</body>
</html>

Open in new window

0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
The viewer will learn how to count occurrences of each item in an array.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now