Solved

Simple Show/Hide issue

Posted on 2011-09-22
3
260 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
ID: 36581396
You missed:
  count<=5;
0
 

Author Closing Comment

by:jscripter1138
ID: 36581451
Another set of eyes always helps.... Thank you
0
 
LVL 63

Expert Comment

by:Zvonko
ID: 36581606
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

The New “Normal” in Modern Enterprise Operations

DevOps for the modern enterprise offers many benefits — increased agility, productivity, and more, but digital transformation isn’t easy, especially if you’re not addressing the right issues. Register for the webinar to dive into the “new normal” for enterprise modern ops.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
Batch, VBS, and scripts in general are incredibly useful for repetitive tasks.  Some tasks can take a while to complete and it can be annoying to check back only to discover that your script finished 5 minutes ago.  Some scripts may complete nearly …
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

821 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