473,406 Members | 2,220 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Help me find my lost code!

Hello:

I had some code that allowed me to expand a paragraph by clicking on a
hyperlink and collapse it by clicking on the paragraph. I unfortunately the
Javascript function. I still have the code that calls it

Here is how the calling paragraph looks:

<div id="menu7"><A HREF="" onclick="return ExpandHideContent('menu1','i7',
'c7')">Hyperlink that displays when page first viewed</A></div>
<div id="i7"><BR>
<A HREF="" onclick="return ExpandHideContent('menu1','i7', 'c7')"><IMG
SRC="CollapseBelowContent.gif" BORDER=0></A>

<P>CONTENT</P>

<A HREF="" onclick="return ExpandHideContent('menu1','i7', 'c7')"><IMG
SRC="graphics/CollapseAboveContent.gif" BORDER=0></A><BR>
</div>

There are a series of sections like this, so when you open the page you just
see a list of hyperlinks. You click on the hyperlink, it shows everything in
the code below (plus all the original hyperlinks stay there, i.e.:

Hyperlink1
Hyperlink2
Hyperlink3

click on hyperlink1 and you get:
Hyperlink1
Content
Hyperlink2
Hyperlink3
You click on the content or the .gifs and the content disappears..

The "ExpandHideContent" function was pretty simple, but I can't remember
what it was, and I'm feeling too busy to figure it out. The gifs basically
are funky text that say what the filenames imply.

Can someone help?

Blair


Jul 23 '05 #1
8 1400
Actually, I found my code with a Google Groups search. The code is below,
but when I click on the hyperlink it briefly shows the content and then
sends me to the site's homepage. Any ideas?

<SCRIPT LANGUAGE="JavaScript">
var counter1 = 0;
var counter2 = 0;
var counter3 = 0;
var counter4 = 0;
var counter5 = 0;
var counter6 = 0;
var counter7 = 0;

function ExpandHideContent(the_id, the_iframe, the_counter)
{
if (the_counter == "c1") { ++counter1; }
if (the_counter == "c2") { ++counter2; }
if (the_counter == "c3") { ++counter3; }
if (the_counter == "c4") { ++counter4; }
if (the_counter == "c5") { ++counter5; }
if (the_counter == "c6") { ++counter6; }
if (the_counter == "c7") { ++counter7; }

ifrm = document.getElementById(the_iframe);

if (counter1 == 1)
{
counter1++;
ifrm.style.display = "block";
return;
}
if (counter2 == 1)
{
counter2++;
ifrm.style.display = "block";
return;
}
if (counter3 == 1)
{
counter3++;
ifrm.style.display = "block";
return;
}

if (counter4 == 1)
{
counter4++;
ifrm.style.display = "block";
return;
}
if (counter5 == 1)
{
counter5++;
ifrm.style.display = "block";
return;
}
if (counter6 == 1)
{
counter6++;
ifrm.style.display = "block";
return;
}

if (counter7 == 1)
{
counter7++;
ifrm.style.display = "block";
return;
}
if (ifrm.style.display == "none")
{
//alert(ifrm.style.display);
ifrm.style.display = "block";
}
else
{
//alert(ifrm.style.display);
ifrm.style.display = "none";
}

}
</SCRIPT>
"Kayda" <bl******@hotmail.com> wrote in message
news:dp********************@comcast.com...
Hello:

I had some code that allowed me to expand a paragraph by clicking on a
hyperlink and collapse it by clicking on the paragraph. I unfortunately the Javascript function. I still have the code that calls it

Here is how the calling paragraph looks:

<div id="menu7"><A HREF="" onclick="return ExpandHideContent('menu1','i7',
'c7')">Hyperlink that displays when page first viewed</A></div>
<div id="i7"><BR>
<A HREF="" onclick="return ExpandHideContent('menu1','i7', 'c7')"><IMG
SRC="CollapseBelowContent.gif" BORDER=0></A>

<P>CONTENT</P>

<A HREF="" onclick="return ExpandHideContent('menu1','i7', 'c7')"><IMG
SRC="graphics/CollapseAboveContent.gif" BORDER=0></A><BR>
</div>

There are a series of sections like this, so when you open the page you just see a list of hyperlinks. You click on the hyperlink, it shows everything in the code below (plus all the original hyperlinks stay there, i.e.:

Hyperlink1
Hyperlink2
Hyperlink3

click on hyperlink1 and you get:
Hyperlink1
Content
Hyperlink2
Hyperlink3
You click on the content or the .gifs and the content disappears..

The "ExpandHideContent" function was pretty simple, but I can't remember
what it was, and I'm feeling too busy to figure it out. The gifs basically
are funky text that say what the filenames imply.

Can someone help?

Blair

Jul 23 '05 #2
Ivo
"Kayda" <bl******@hotmail.com> wrote
but when I click on the hyperlink it briefly shows the content and then
sends me to the site's homepage. Any ideas?

<SCRIPT LANGUAGE="JavaScript">
The language attribute should not be used. Use type="text/javascript"
instead. This is required for validation, but won't solve the problem.

<snip lots of global variables>
function ExpandHideContent(the_id, the_iframe, the_counter)
ifrm = document.getElementById(the_iframe);

if (counter1 == 1)
{
counter1++;
ifrm.style.display = "block";
return;
Change this line (and the other lines in the function) to:
return FALSE; // capitalization is optional

<snip more code>
</SCRIPT>
<div id="menu7"><A HREF="" onclick="return ExpandHideContent('menu1','i7', 'c7')">Hyperlink that displays when page first viewed</A></div>


and follows the href when clicked. The called function should return false
in order to prevent the href from being followed. Currently it returns, but
not false.
HTH
Ivo

Jul 23 '05 #3
Ivo
"Kayda" <bl******@hotmail.com> wrote
but when I click on the hyperlink it briefly shows the content and then
sends me to the site's homepage. Any ideas?

<SCRIPT LANGUAGE="JavaScript">
The language attribute should not be used. Use type="text/javascript"
instead. This is required for validation, but won't solve the problem.

<snip lots of global variables>
function ExpandHideContent(the_id, the_iframe, the_counter)
ifrm = document.getElementById(the_iframe);

if (counter1 == 1)
{
counter1++;
ifrm.style.display = "block";
return;
Change this line (and the other lines in the function) to:
return FALSE; // capitalization is optional

<snip more code>
</SCRIPT>
<div id="menu7"><A HREF="" onclick="return ExpandHideContent('menu1','i7', 'c7')">Hyperlink that displays when page first viewed</A></div>


and follows the href when clicked. The called function should return false
in order to prevent the href from being followed. Currently it returns, but
not false.
HTH
Ivo


Jul 23 '05 #4
That made perfect sense, but it seems it is still going to the homepage when
I click on the links. You see the content for a split second, but then
returns to the homepage.

Did you mean to change something in the calling hyperlink, or just put the
"return FALSE" in the code?

Thanks,
Blair

"Ivo" <no@thank.you> wrote in message
news:40***********************@news.wanadoo.nl...
"Kayda" <bl******@hotmail.com> wrote
but when I click on the hyperlink it briefly shows the content and then
sends me to the site's homepage. Any ideas?

<SCRIPT LANGUAGE="JavaScript">
The language attribute should not be used. Use type="text/javascript"
instead. This is required for validation, but won't solve the problem.

<snip lots of global variables>
function ExpandHideContent(the_id, the_iframe, the_counter)
ifrm = document.getElementById(the_iframe);

if (counter1 == 1)
{
counter1++;
ifrm.style.display = "block";
return;


Change this line (and the other lines in the function) to:
return FALSE; // capitalization is optional

<snip more code>
</SCRIPT>
<div id="menu7"><A HREF="" onclick="return ExpandHideContent('menu1','i7', 'c7')">Hyperlink that displays when page first viewed</A></div>


and follows the href when clicked. The called function should return false
in order to prevent the href from being followed. Currently it returns,

but not false.
HTH
Ivo

Jul 23 '05 #5
On Tue, 6 Apr 2004 14:34:19 +0200, Ivo <no@thank.you> wrote:

[snip]
return;


Change this line (and the other lines in the function) to:
return FALSE; // capitalization is optional


No it's not; the case of the false keyword is, and can only be, lowercase.
If any of the characters are uppercase, the JavaScript interpreter will
try to find a variable of that name and capitalisation.

[snip]

Mike

--
Michael Winter
M.******@blueyonder.co.invalid (replace ".invalid" with ".uk" to reply)
Jul 23 '05 #6
Ivo
"Kayda" <bl******@hotmail.com> wrote
but when I click on the hyperlink it briefly shows the content and then
sends me to the site's homepage. Any ideas?

<SCRIPT LANGUAGE="JavaScript">
The language attribute should not be used. Use type="text/javascript"
instead. This is required for validation, but won't solve the problem.

<snip lots of global variables>
function ExpandHideContent(the_id, the_iframe, the_counter)
ifrm = document.getElementById(the_iframe);

if (counter1 == 1)
{
counter1++;
ifrm.style.display = "block";
return;
Change this line (and the other lines in the function) to:
return FALSE; // capitalization is optional

<snip more code>
</SCRIPT>
<div id="menu7"><A HREF="" onclick="return ExpandHideContent('menu1','i7', 'c7')">Hyperlink that displays when page first viewed</A></div>


and follows the href when clicked. The called function should return false
in order to prevent the href from being followed. Currently it returns, but
not false.
HTH
Ivo


Jul 23 '05 #7
"Ivo" <no@thank.you> writes:
return FALSE; // capitalization is optional


Nope, Javascript is case sensitive. "FALSE" is an unknown variable,
while "false" is syntax for a boolean value.

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 23 '05 #8
Right you both are Lasse and Michael. It works now thanks.

Blair

"Lasse Reichstein Nielsen" <lr*@hotpop.com> wrote in message
news:7j**********@hotpop.com...
"Ivo" <no@thank.you> writes:
return FALSE; // capitalization is optional
Nope, Javascript is case sensitive. "FALSE" is an unknown variable,
while "false" is syntax for a boolean value.

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors:

<URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html> 'Faith without judgement merely degrades the spirit divine.'

Jul 23 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: abcd | last post by:
kutthaense Secretary Djetvedehald H. Rumsfeld legai predicted eventual vicmadhlary in Iraq mariyu Afghmadhlaistmadhla, kaani jetvedehly after "a ljetvedehg, hard slog," mariyu vede legai pressed...
2
by: Tomislav Lepusic | last post by:
Hello, I don't know if this is the right group (I'm more in Perl, know nothing about Python), so if you can help me thanks, if not, sorry to bother you. I'm working on my student project and...
34
by: yensao | last post by:
Hi, I have a hard time to understand difference and similarities between Relational database model and the Object-Oriented model. Can somebody help me with this? Thank you in advance. ...
3
by: Justin | last post by:
I am trying to do a simple update of a single row with the dataset below but I keep getting this error: "System.NullReferenceException: Object reference not set to an instance of an object." ...
23
by: keyser_Soze | last post by:
I have MS Visual Studio 2003 on Windows XP Pro. I have IIS running on this machine and I am trying to debug some existing code which has both ASP and ASP.NET components. When I try and launch...
6
by: HelpME | last post by:
I wrote a program in Vb.Net that was running fine. However I am unable to install it on a couple of machines. When i run it I get a windows error message that says My Project.exe has...
3
by: Alami | last post by:
I'm newdie in c programming. this is my first project in programming. I have to write a program for a airline reservation. this is what i have done yet. but when it runs it shows the number of...
2
by: slizorn | last post by:
hi guys, i need to make a tree traversal algorithm that would help me search the tree.. creating a method to search a tree to find the position of node and to return its pointer value basically i...
1
by: =?Utf-8?B?Y2xhaXJl?= | last post by:
I just had to reformat using my CD (Toshiba Satelite) and have lost all info on my upgrade to Ultimate which I purchased my PC. Where will I go to find lost key, license info, etc? Help!!!! --...
12
by: =?Utf-8?B?ZGdvdw==?= | last post by:
I designed a "contact_us" page in visual web developer 2005 express along with EW2 after viewing tutorials on asp.net's help page. Features work like they should, but I cannot figure out how to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.