Solved

Simple Show/Hide issue

Posted on 2011-09-22
3
259 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

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…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

831 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