|
List Info
Thread: Calling two functions with one onclick event
|
|
| Calling two functions with one onclick
event |

|
2007-10-21 06:13:04 |
Hi
I am trying to hide two layers using
getElementById(layerid);
I have two functions set-up, one for each of the layers.
Can some one please tell me how I can call both functions
with one
mouse click.
This code successfully calls one of the functions -
onClick="JavaScript:return
hideLayer1('answer1text');">Click here</a>
Thanks Michael
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "JavaScript Forum" group.
To post to this group, send email to
JavaScript-Information googlegroups.com
To unsubscribe from this group, send email to
JavaScript-Information-unsubscribe googlegroups.com
For more options, visit this group at http://groups.google.com/group/JavaScript-Information
?hl=en
-~----------~----~----~----~------~----~------~--~---
|
|
| Re: Calling two functions with one
onclick event |

|
2007-10-21 15:00:14 |
you can either do onclick="hideLayer1('answer1text');
hideLayer2('layer2_ID');"
or you can create a function that hides both, for example:
function hideLayers(){
hideLayer1('answer1text');
hideLayer2('layer2_ID');
}
and then call hideLayers from the onclick event
Hope that helps.
On Oct 21, 7:13 am, max <mich... boyce836.fsnet.co.uk>
wrote:
> Hi
> I am trying to hide two layers using
getElementById(layerid);
>
> I have two functions set-up, one for each of the
layers.
> Can some one please tell me how I can call both
functions with one
> mouse click.
>
> This code successfully calls one of the functions -
>
> onClick="JavaScript:return
hideLayer1('answer1text');">Click here</a>
>
> Thanks Michael
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "JavaScript Forum" group.
To post to this group, send email to
JavaScript-Information googlegroups.com
To unsubscribe from this group, send email to
JavaScript-Information-unsubscribe googlegroups.com
For more options, visit this group at http://groups.google.com/group/JavaScript-Information
?hl=en
-~----------~----~----~----~------~----~------~--~---
|
|
| Re: Calling two functions with one
onclick event |

|
2007-10-22 07:49:00 |
Hi
Thanks for the help
But I tried both of your suggestions without any success
Here is the code I am using :
<script language = "JavaScript 2.1"
type = "text/javascript">
<!--
function showLayer(layerid)
{
var layer = new Object();
layer = document.getElementById(layerid);
layer.style.visibility = "visible";
return false;
}//end showLayer
function hideLayer(layerid)
{
var layer = new Object();
layer = document.getElementById(layerid);
layer.style.visibility = "hidden";
return false;
}//end hideLayer
function hideLayer2(layerid)
{
var layer = new Object();
layer = document.getElementById(layerid);
layer.style.visibility = "hidden";
return false;
}//end hideLayer
// -->
</script>
<meta http-equiv="Content-Type"
content="text/html;
charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
<div id="answer1bg"
style="position:absolute;
left:311px;
top:146px;
width:472px;
height:143px;
z-index:1;
background-color: #004A80;
visibility:visible"></div>
<div id="answer1text"
style="position:absolute;
font-family:Arial, Helvetica, sans-serif;
font-size:14pt;
left:325px;
top:152px;
width:452px;
height:46px;
z-index:2;
visibility:visible;
color: #FFFFAA">The Bureau is a charitable
organization mainly
funded by
This enables Haddington to have one full time member of
staff
(Manager).
Project funding has been secured to employ additional paid
staff for
specialist services e.g. Money Advice.</div>
<div id="topbg"
style="position:absolute;
left:311px;
top:115px;
width:472px;
height:46px;
z-index:2;
visibility:visible"><img
src="images/new/
top.gif" /></div>
<div id="question1"
style="position:absolute;
font-family:Arial, Helvetica, sans-serif;
font-size:14pt;
font-weight:400;
left:449px;
top:126px;
width:472px;
height:46px;
z-index:2;
color: #004A80;
visibility:visible"><a
href="#"
onClick="JavaScript:return
hideLayer2('answer1text');
hideLayer('answer1bg');">How Is
Funded?</a></div>
Any further help would be welcome!
Regards Michael
On 21 Oct, 21:00, Israel Schulman <israel.schul... gmail.com> wrote:
> you can either do
onclick="hideLayer1('answer1text');
> hideLayer2('layer2_ID');"
>
> or you can create a function that hides both, for
example:
>
> function hideLayers(){
> hideLayer1('answer1text');
> hideLayer2('layer2_ID');
>
> }
>
> and then call hideLayers from the onclick event
>
> Hope that helps.
>
> On Oct 21, 7:13 am, max <mich... boyce836.fsnet.co.uk> wrote:
>
>
>
> > Hi
> > I am trying to hide two layers using
getElementById(layerid);
>
> > I have two functions set-up, one for each of the
layers.
> > Can some one please tell me how I can call both
functions with one
> > mouse click.
>
> > This code successfully calls one of the functions
-
>
> > onClick="JavaScript:return
hideLayer1('answer1text');">Click here</a>
>
> > Thanks Michael- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "JavaScript Forum" group.
To post to this group, send email to
JavaScript-Information googlegroups.com
To unsubscribe from this group, send email to
JavaScript-Information-unsubscribe googlegroups.com
For more options, visit this group at http://groups.google.com/group/JavaScript-Information
?hl=en
-~----------~----~----~----~------~----~------~--~---
|
|
| Re: Calling two functions with one
onclick event |

|
2007-10-22 08:56:16 |
Try:
<a href="#"
onClick="hideLayer2('answer1text');hideLayer('answer1bg
');">How Is
Funded?</a>
leaving out the javascript: return , which I don't believe
you need,
seems to fix it.
On Oct 22, 8:49 am, max <mich... boyce836.fsnet.co.uk>
wrote:
> Hi
> Thanks for the help
> But I tried both of your suggestions without any
success
> Here is the code I am using :
>
> <script language = "JavaScript 2.1"
> type = "text/javascript">
> <!--
>
> function showLayer(layerid)
> {
> var layer = new Object();
> layer = document.getElementById(layerid);
> layer.style.visibility = "visible";
>
> return false;
> }//end showLayer
>
> function hideLayer(layerid)
> {
> var layer = new Object();
> layer = document.getElementById(layerid);
> layer.style.visibility = "hidden";
>
> return false;
> }//end hideLayer
>
> function hideLayer2(layerid)
> {
> var layer = new Object();
> layer = document.getElementById(layerid);
> layer.style.visibility = "hidden";
>
> return false;
> }//end hideLayer
> // -->
> </script>
> <meta http-equiv="Content-Type"
content="text/html;
> charset=iso-8859-1" />
> <title>Untitled Document</title>
> </head>
>
> <body>
> <div id="answer1bg"
> style="position:absolute;
> left:311px;
> top:146px;
> width:472px;
> height:143px;
> z-index:1;
>
background-color: #004A80;
>
visibility:visible"></div>
> <div id="answer1text"
> style="position:absolute;
>
font-family:Arial, Helvetica, sans-serif;
>
font-size:14pt;
> left:325px;
> top:152px;
> width:452px;
> height:46px;
> z-index:2;
> visibility:visible;
> color:
#FFFFAA">The Bureau is a charitable organization
mainly
> funded by
> This enables Haddington to have one full time member of
staff
> (Manager).
> Project funding has been secured to employ additional
paid staff for
> specialist services e.g. Money Advice.</div>
>
> <div id="topbg"
> style="position:absolute;
> left:311px;
> top:115px;
> width:472px;
> height:46px;
> z-index:2;
>
visibility:visible"><img src="images/new/
> top.gif" /></div>
>
> <div id="question1"
> style="position:absolute;
> font-family:Arial,
Helvetica, sans-serif;
> font-size:14pt;
> font-weight:400;
> left:449px;
> top:126px;
> width:472px;
> height:46px;
> z-index:2;
> color:
#004A80;
> visibility:visible"><a
href="#"
> onClick="JavaScript:return
hideLayer2('answer1text');
>
hideLayer('answer1bg');">How Is
Funded?</a></div>
>
> Any further help would be welcome!
>
> Regards Michael
>
> On 21 Oct, 21:00, Israel Schulman
<israel.schul... gmail.com> wrote:
>
> > you can either do
onclick="hideLayer1('answer1text');
> > hideLayer2('layer2_ID');"
>
> > or you can create a function that hides both, for
example:
>
> > function hideLayers(){
> > hideLayer1('answer1text');
> > hideLayer2('layer2_ID');
>
> > }
>
> > and then call hideLayers from the onclick event
>
> > Hope that helps.
>
> > On Oct 21, 7:13 am, max <mich... boyce836.fsnet.co.uk> wrote:
>
> > > Hi
> > > I am trying to hide two layers using
getElementById(layerid);
>
> > > I have two functions set-up, one for each of
the layers.
> > > Can some one please tell me how I can call
both functions with one
> > > mouse click.
>
> > > This code successfully calls one of the
functions -
>
> > > onClick="JavaScript:return
hideLayer1('answer1text');">Click here</a>
>
> > > Thanks Michael- Hide quoted text -
>
> > - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "JavaScript Forum" group.
To post to this group, send email to
JavaScript-Information googlegroups.com
To unsubscribe from this group, send email to
JavaScript-Information-unsubscribe googlegroups.com
For more options, visit this group at http://groups.google.com/group/JavaScript-Information
?hl=en
-~----------~----~----~----~------~----~------~--~---
|
|
| Re: Calling two functions with one
onclick event |

|
2007-10-22 09:37:42 |
Hi
It is now working fine.
Thanks for the help!
If possible could you tell me how to make the layers
re-appear.
I know that I could create another couple of functions, but
how
do I add the new function calls onto the same button that I
used
to hide them.
Your help is appreciated!
On 22 Oct, 14:56, Israel Schulman <israel.schul... gmail.com> wrote:
> Try:
>
> <a href="#"
>
onClick="hideLayer2('answer1text');hideLayer('answer1bg
');">How Is
> Funded?</a>
>
> leaving out the javascript: return , which I don't
believe you need,
> seems to fix it.
>
> On Oct 22, 8:49 am, max <mich... boyce836.fsnet.co.uk> wrote:
>
>
>
> > Hi
> > Thanks for the help
> > But I tried both of your suggestions without any
success
> > Here is the code I am using :
>
> > <script language = "JavaScript 2.1"
> > type =
"text/javascript">
> > <!--
>
> > function showLayer(layerid)
> > {
> > var layer = new Object();
> > layer = document.getElementById(layerid);
> > layer.style.visibility =
"visible";
>
> > return false;
> > }//end showLayer
>
> > function hideLayer(layerid)
> > {
> > var layer = new Object();
> > layer = document.getElementById(layerid);
> > layer.style.visibility =
"hidden";
>
> > return false;
> > }//end hideLayer
>
> > function hideLayer2(layerid)
> > {
> > var layer = new Object();
> > layer = document.getElementById(layerid);
> > layer.style.visibility =
"hidden";
>
> > return false;
> > }//end hideLayer
> > // -->
> > </script>
> > <meta http-equiv="Content-Type"
content="text/html;
> > charset=iso-8859-1" />
> > <title>Untitled Document</title>
> > </head>
>
> > <body>
> > <div id="answer1bg"
> > style="position:absolute;
> > left:311px;
> > top:146px;
> > width:472px;
> > height:143px;
> > z-index:1;
> >
background-color: #004A80;
> >
visibility:visible"></div>
> > <div id="answer1text"
> >
style="position:absolute;
> >
font-family:Arial, Helvetica, sans-serif;
> >
font-size:14pt;
> > left:325px;
> > top:152px;
> > width:452px;
> > height:46px;
> > z-index:2;
> > visibility:visible;
> > color:
#FFFFAA">The Bureau is a charitable organization
mainly
> > funded by
> > This enables Haddington to have one full time
member of staff
> > (Manager).
> > Project funding has been secured to employ
additional paid staff for
> > specialist services e.g. Money
Advice.</div>
>
> > <div id="topbg"
> > style="position:absolute;
> > left:311px;
> > top:115px;
> > width:472px;
> > height:46px;
> > z-index:2;
> >
visibility:visible"><img src="images/new/
> > top.gif" /></div>
>
> > <div id="question1"
> > style="position:absolute;
> > font-family:Arial,
Helvetica, sans-serif;
> > font-size:14pt;
> > font-weight:400;
> > left:449px;
> > top:126px;
> > width:472px;
> > height:46px;
> > z-index:2;
> > color:
#004A80;
> >
visibility:visible"><a href="#"
> > onClick="JavaScript:return
hideLayer2('answer1text');
> >
hideLayer('answer1bg');">How Is
Funded?</a></div>
>
> > Any further help would be welcome!
>
> > Regards Michael
>
> > On 21 Oct, 21:00, Israel Schulman
<israel.schul... gmail.com> wrote:
>
> > > you can either do
onclick="hideLayer1('answer1text');
> > > hideLayer2('layer2_ID');"
>
> > > or you can create a function that hides both,
for example:
>
> > > function hideLayers(){
> > > hideLayer1('answer1text');
> > > hideLayer2('layer2_ID');
>
> > > }
>
> > > and then call hideLayers from the onclick
event
>
> > > Hope that helps.
>
> > > On Oct 21, 7:13 am, max <mich... boyce836.fsnet.co.uk> wrote:
>
> > > > Hi
> > > > I am trying to hide two layers using
getElementById(layerid);
>
> > > > I have two functions set-up, one for
each of the layers.
> > > > Can some one please tell me how I can
call both functions with one
> > > > mouse click.
>
> > > > This code successfully calls one of the
functions -
>
> > > > onClick="JavaScript:return
hideLayer1('answer1text');">Click here</a>
>
> > > > Thanks Michael- Hide quoted text -
>
> > > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "JavaScript Forum" group.
To post to this group, send email to
JavaScript-Information googlegroups.com
To unsubscribe from this group, send email to
JavaScript-Information-unsubscribe googlegroups.com
For more options, visit this group at http://groups.google.com/group/JavaScript-Information
?hl=en
-~----------~----~----~----~------~----~------~--~---
|
|
| Re: Calling two functions with one
onclick event |

|
2007-10-22 10:03:17 |
Try:
function hideLayer(layerid)
{
var layer = new Object();
layer = document.getElementById(layerid);
var visible = layer.style.visibility != "hidden"
if(visible){
layer.style.visibility = "hidden";
}else{
layer.style.visibility = "visible";
}
}//end hideLayer
Also change the onclick event to:
<a href="#"
onClick="hideLayer('answer1text');hideLayer('answer1bg'
);">How Is
Funded?</a>
In my previous post I forgot to change the first called
function from
"hideLayer2" to "hideLayer"
so that both calls are referencing the same function.
On Oct 22, 10:37 am, max <mich... boyce836.fsnet.co.uk>
wrote:
> Hi
> It is now working fine.
> Thanks for the help!
>
> If possible could you tell me how to make the layers
re-appear.
> I know that I could create another couple of functions,
but how
> do I add the new function calls onto the same button
that I used
> to hide them.
> Your help is appreciated!
>
> On 22 Oct, 14:56, Israel Schulman
<israel.schul... gmail.com> wrote:
>
> > Try:
>
> > <a href="#"
> >
onClick="hideLayer2('answer1text');hideLayer('answer1bg
');">How Is
> > Funded?</a>
>
> > leaving out the javascript: return , which I don't
believe you need,
> > seems to fix it.
>
> > On Oct 22, 8:49 am, max <mich... boyce836.fsnet.co.uk> wrote:
>
> > > Hi
> > > Thanks for the help
> > > But I tried both of your suggestions without
any success
> > > Here is the code I am using :
>
> > > <script language = "JavaScript
2.1"
> > > type =
"text/javascript">
> > > <!--
>
> > > function showLayer(layerid)
> > > {
> > > var layer = new Object();
> > > layer =
document.getElementById(layerid);
> > > layer.style.visibility =
"visible";
>
> > > return false;
> > > }//end showLayer
>
> > > function hideLayer(layerid)
> > > {
> > > var layer = new Object();
> > > layer =
document.getElementById(layerid);
> > > layer.style.visibility =
"hidden";
>
> > > return false;
> > > }//end hideLayer
>
> > > function hideLayer2(layerid)
> > > {
> > > var layer = new Object();
> > > layer =
document.getElementById(layerid);
> > > layer.style.visibility =
"hidden";
>
> > > return false;
> > > }//end hideLayer
> > > // -->
> > > </script>
> > > <meta http-equiv="Content-Type"
content="text/html;
> > > charset=iso-8859-1" />
> > > <title>Untitled Document</title>
> > > </head>
>
> > > <body>
> > > <div id="answer1bg"
> > >
style="position:absolute;
> > > left:311px;
> > > top:146px;
> > > width:472px;
> > > height:143px;
> > > z-index:1;
> > >
background-color: #004A80;
> > >
visibility:visible"></div>
> > > <div id="answer1text"
> > >
style="position:absolute;
> > >
font-family:Arial, Helvetica, sans-serif;
> > >
font-size:14pt;
> > > left:325px;
> > > top:152px;
> > > width:452px;
> > > height:46px;
> > > z-index:2;
> > > visibility:visible;
> > >
color: #FFFFAA">The Bureau is a charitable
organization mainly
> > > funded by
> > > This enables Haddington to have one full time
member of staff
> > > (Manager).
> > > Project funding has been secured to employ
additional paid staff for
> > > specialist services e.g. Money
Advice.</div>
>
> > > <div id="topbg"
> > >
style="position:absolute;
> > > left:311px;
> > > top:115px;
> > > width:472px;
> > > height:46px;
> > > z-index:2;
> > >
visibility:visible"><img src="images/new/
> > > top.gif" /></div>
>
> > > <div id="question1"
> > >
style="position:absolute;
> > > font-family:Arial,
Helvetica, sans-serif;
> > > font-size:14pt;
> > > font-weight:400;
> > > left:449px;
> > > top:126px;
> > > width:472px;
> > > height:46px;
> > > z-index:2;
> > >
color: #004A80;
> > >
visibility:visible"><a href="#"
> > > onClick="JavaScript:return
hideLayer2('answer1text');
> > >
hideLayer('answer1bg');">How Is
Funded?</a></div>
>
> > > Any further help would be welcome!
>
> > > Regards Michael
>
> > > On 21 Oct, 21:00, Israel Schulman
<israel.schul... gmail.com> wrote:
>
> > > > you can either do
onclick="hideLayer1('answer1text');
> > > > hideLayer2('layer2_ID');"
>
> > > > or you can create a function that hides
both, for example:
>
> > > > function hideLayers(){
> > > > hideLayer1('answer1text');
> > > > hideLayer2('layer2_ID');
>
> > > > }
>
> > > > and then call hideLayers from the
onclick event
>
> > > > Hope that helps.
>
> > > > On Oct 21, 7:13 am, max <mich... boyce836.fsnet.co.uk> wrote:
>
> > > > > Hi
> > > > > I am trying to hide two layers
using getElementById(layerid);
>
> > > > > I have two functions set-up, one
for each of the layers.
> > > > > Can some one please tell me how I
can call both functions with one
> > > > > mouse click.
>
> > > > > This code successfully calls one of
the functions -
>
> > > > > onClick="JavaScript:return
hideLayer1('answer1text');">Click here</a>
>
> > > > > Thanks Michael- Hide quoted text -
>
> > > > - Show quoted text -- Hide quoted text
-
>
> > - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "JavaScript Forum" group.
To post to this group, send email to
JavaScript-Information googlegroups.com
To unsubscribe from this group, send email to
JavaScript-Information-unsubscribe googlegroups.com
For more options, visit this group at http://groups.google.com/group/JavaScript-Information
?hl=en
-~----------~----~----~----~------~----~------~--~---
|
|
| Re: Calling two functions with one
onclick event |

|
2007-10-22 10:48:06 |
Hi
Thanks alot, the onClick shows/hides the layers as
required.
Much appreciated!!!
On 22 Oct, 16:03, Israel Schulman <israel.schul... gmail.com> wrote:
> Try:
>
> function hideLayer(layerid)
> {
> var layer = new Object();
> layer = document.getElementById(layerid);
> var visible = layer.style.visibility !=
"hidden"
>
> if(visible){
> layer.style.visibility =
"hidden";
> }else{
> layer.style.visibility =
"visible";
> }
>
> }//end hideLayer
>
> Also change the onclick event to:
>
> <a href="#"
>
onClick="hideLayer('answer1text');hideLayer('answer1bg'
);">How Is
> Funded?</a>
>
> In my previous post I forgot to change the first called
function from
> "hideLayer2" to "hideLayer"
> so that both calls are referencing the same function.
>
> On Oct 22, 10:37 am, max <mich... boyce836.fsnet.co.uk> wrote:
>
>
>
> > Hi
> > It is now working fine.
> > Thanks for the help!
>
> > If possible could you tell me how to make the
layers re-appear.
> > I know that I could create another couple of
functions, but how
> > do I add the new function calls onto the same
button that I used
> > to hide them.
> > Your help is appreciated!
>
> > On 22 Oct, 14:56, Israel Schulman
<israel.schul... gmail.com> wrote:
>
> > > Try:
>
> > > <a href="#"
> > >
onClick="hideLayer2('answer1text');hideLayer('answer1bg
');">How Is
> > > Funded?</a>
>
> > > leaving out the javascript: return , which I
don't believe you need,
> > > seems to fix it.
>
> > > On Oct 22, 8:49 am, max <mich... boyce836.fsnet.co.uk> wrote:
>
> > > > Hi
> > > > Thanks for the help
> > > > But I tried both of your suggestions
without any success
> > > > Here is the code I am using :
>
> > > > <script language = "JavaScript
2.1"
> > > > type =
"text/javascript">
> > > > <!--
>
> > > > function showLayer(layerid)
> > > > {
> > > > var layer = new Object();
> > > > layer =
document.getElementById(layerid);
> > > > layer.style.visibility =
"visible";
>
> > > > return false;
> > > > }//end showLayer
>
> > > > function hideLayer(layerid)
> > > > {
> > > > var layer = new Object();
> > > > layer =
document.getElementById(layerid);
> > > > layer.style.visibility =
"hidden";
>
> > > > return false;
> > > > }//end hideLayer
>
> > > > function hideLayer2(layerid)
> > > > {
> > > > var layer = new Object();
> > > > layer =
document.getElementById(layerid);
> > > > layer.style.visibility =
"hidden";
>
> > > > return false;
> > > > }//end hideLayer
> > > > // -->
> > > > </script>
> > > > <meta
http-equiv="Content-Type"
content="text/html;
> > > > charset=iso-8859-1" />
> > > > <title>Untitled
Document</title>
> > > > </head>
>
> > > > <body>
> > > > <div id="answer1bg"
> > > >
style="position:absolute;
> > > > left:311px;
> > > > top:146px;
> > > > width:472px;
> > > > height:143px;
> > > > z-index:1;
> > > >
background-color: #004A80;
> > > >
visibility:visible"></div>
> > > > <div id="answer1text"
> > > >
style="position:absolute;
> > > >
font-family:Arial, Helvetica, sans-serif;
> > > >
font-size:14pt;
> > > > left:325px;
> > > > top:152px;
> > > > width:452px;
> > > > height:46px;
> > > > z-index:2;
> > > >
visibility:visible;
> > > >
color: #FFFFAA">The Bureau is a charitable
organization mainly
> > > > funded by
> > > > This enables Haddington to have one full
time member of staff
> > > > (Manager).
> > > > Project funding has been secured to
employ additional paid staff for
> > > > specialist services e.g. Money
Advice.</div>
>
> > > > <div id="topbg"
> > > >
style="position:absolute;
> > > > left:311px;
> > > > top:115px;
> > > > width:472px;
> > > > height:46px;
> > > > z-index:2;
> > > >
visibility:visible"><img src="images/new/
> > > > top.gif" /></div>
>
> > > > <div id="question1"
> > > >
style="position:absolute;
> > > >
font-family:Arial, Helvetica, sans-serif;
> > > >
font-size:14pt;
> > > >
font-weight:400;
> > > > left:449px;
> > > > top:126px;
> > > > width:472px;
> > > > height:46px;
> > > > z-index:2;
> > > >
color: #004A80;
> > > >
visibility:visible"><a href="#"
> > > >
onClick="JavaScript:return hideLayer2('answer1text');
> > > >
hideLayer('answer1bg');">How Is
Funded?</a></div>
>
> > > > Any further help would be welcome!
>
> > > > Regards Michael
>
> > > > On 21 Oct, 21:00, Israel Schulman
<israel.schul... gmail.com> wrote:
>
> > > > > you can either do
onclick="hideLayer1('answer1text');
> > > > > hideLayer2('layer2_ID');"
>
> > > > > or you can create a function that
hides both, for example:
>
> > > > > function hideLayers(){
> > > > > hideLayer1('answer1text');
> > > > > hideLayer2('layer2_ID');
>
> > > > > }
>
> > > > > and then call hideLayers from the
onclick event
>
> > > > > Hope that helps.
>
> > > > > On Oct 21, 7:13 am, max
<mich... boyce836.fsnet.co.uk> wrote:
>
> > > > > > Hi
> > > > > > I am trying to hide two layers
using getElementById(layerid);
>
> > > > > > I have two functions set-up,
one for each of the layers.
> > > > > > Can some one please tell me
how I can call both functions with one
> > > > > > mouse click.
>
> > > > > > This code successfully calls
one of the functions -
>
> > > > > >
onClick="JavaScript:return
hideLayer1('answer1text');">Click here</a>
>
> > > > > > Thanks Michael- Hide quoted
text -
>
> > > > > - Show quoted text -- Hide quoted
text -
>
> > > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "JavaScript Forum" group.
To post to this group, send email to
JavaScript-Information googlegroups.com
To unsubscribe from this group, send email to
JavaScript-Information-unsubscribe googlegroups.com
For more options, visit this group at http://groups.google.com/group/JavaScript-Information
?hl=en
-~----------~----~----~----~------~----~------~--~---
|
|
| Re: Calling two functions with one
onclick event |

|
2007-10-22 11:43:54 |
You're welcome.
Regards.
On Oct 22, 11:48 am, max <mich... boyce836.fsnet.co.uk>
wrote:
> Hi
> Thanks alot, the onClick shows/hides the layers as
required.
> Much appreciated!!!
>
> On 22 Oct, 16:03, Israel Schulman
<israel.schul... gmail.com> wrote:
>
> > Try:
>
> > function hideLayer(layerid)
> > {
> > var layer = new Object();
> > layer = document.getElementById(layerid);
> > var visible = layer.style.visibility !=
"hidden"
>
> > if(visible){
> > layer.style.visibility =
"hidden";
> > }else{
> > layer.style.visibility =
"visible";
> > }
>
> > }//end hideLayer
>
> > Also change the onclick event to:
>
> > <a href="#"
> >
onClick="hideLayer('answer1text');hideLayer('answer1bg'
);">How Is
> > Funded?</a>
>
> > In my previous post I forgot to change the first
called function from
> > "hideLayer2" to "hideLayer"
> > so that both calls are referencing the same
function.
>
> > On Oct 22, 10:37 am, max <mich... boyce836.fsnet.co.uk> wrote:
>
> > > Hi
> > > It is now working fine.
> > > Thanks for the help!
>
> > > If possible could you tell me how to make the
layers re-appear.
> > > I know that I could create another couple of
functions, but how
> > > do I add the new function calls onto the same
button that I used
> > > to hide them.
> > > Your help is appreciated!
>
> > > On 22 Oct, 14:56, Israel Schulman
<israel.schul... gmail.com> wrote:
>
> > > > Try:
>
> > > > <a href="#"
> > > >
onClick="hideLayer2('answer1text');hideLayer('answer1bg
');">How Is
> > > > Funded?</a>
>
> > > > leaving out the javascript: return ,
which I don't believe you need,
> > > > seems to fix it.
>
> > > > On Oct 22, 8:49 am, max <mich... boyce836.fsnet.co.uk> wrote:
>
> > > > > Hi
> > > > > Thanks for the help
> > > > > But I tried both of your
suggestions without any success
> > > > > Here is the code I am using :
>
> > > > > <script language =
"JavaScript 2.1"
> > > > > type =
"text/javascript">
> > > > > <!--
>
> > > > > function
showLayer(layerid)
> > > > > {
> > > > > var layer = new Object();
> > > > > layer =
document.getElementById(layerid);
> > > > > layer.style.visibility =
"visible";
>
> > > > > return false;
> > > > > }//end showLayer
>
> > > > > function hideLayer(layerid)
> > > > > {
> > > > > var layer = new Object();
> > > > > layer =
document.getElementById(layerid);
> > > > > layer.style.visibility =
"hidden";
>
> > > > > return false;
> > > > > }//end hideLayer
>
> > > > > function
hideLayer2(layerid)
> > > > > {
> > > > > var layer = new Object();
> > > > > layer =
document.getElementById(layerid);
> > > > > layer.style.visibility =
"hidden";
>
> > > > > return false;
> > > > > }//end hideLayer
> > > > > // -->
> > > > > </script>
> > > > > <meta
http-equiv="Content-Type"
content="text/html;
> > > > > charset=iso-8859-1" />
> > > > > <title>Untitled
Document</title>
> > > > > </head>
>
> > > > > <body>
> > > > > <div id="answer1bg"
> > > > >
style="position:absolute;
> > > > > left:311px;
> > > > > top:146px;
> > > > > width:472px;
> > > > >
height:143px;
> > > > > z-index:1;
> > > > >
background-color: #004A80;
> > > > >
visibility:visible"></div>
> > > > > <div id="answer1text"
> > > > >
style="position:absolute;
> > > > >
font-family:Arial, Helvetica, sans-serif;
> > > > >
font-size:14pt;
> > > > > left:325px;
> > > > > top:152px;
> > > > > width:452px;
> > > > > height:46px;
> > > > > z-index:2;
> > > > >
visibility:visible;
> > > > >
color: #FFFFAA">The Bureau is a charitable
organization mainly
> > > > > funded by
> > > > > This enables Haddington to have one
full time member of staff
> > > > > (Manager).
> > > > > Project funding has been secured to
employ additional paid staff for
> > > > > specialist services e.g. Money
Advice.</div>
>
> > > > > <div id="topbg"
> > > > >
style="position:absolute;
> > > > > left:311px;
> > > > > top:115px;
> > > > > width:472px;
> > > > > height:46px;
> > > > > z-index:2;
> > > > >
visibility:visible"><img src="images/new/
> > > > > top.gif" /></div>
>
> > > > > <div id="question1"
> > > > >
style="position:absolute;
> > > > >
font-family:Arial, Helvetica, sans-serif;
> > > > >
font-size:14pt;
> > > > >
font-weight:400;
> > > > > left:449px;
> > > > > top:126px;
> > > > > width:472px;
> > > > > height:46px;
> > > > > z-index:2;
> > > > >
color: #004A80;
> > > > >
visibility:visible"><a href="#"
> > > > >
onClick="JavaScript:return hideLayer2('answer1text');
> > > > >
hideLayer('answer1bg');">How Is
Funded?</a></div>
>
> > > > > Any further help would be welcome!
>
> > > > > Regards Michael
>
> > > > > On 21 Oct, 21:00, Israel Schulman
<israel.schul... gmail.com> wrote:
>
> > > > > > you can either do
onclick="hideLayer1('answer1text');
> > > > > >
hideLayer2('layer2_ID');"
>
> > > > > > or you can create a function
that hides both, for example:
>
> > > > > > function hideLayers(){
> > > > > > hideLayer1('answer1text');
> > > > > > hideLayer2('layer2_ID');
>
> > > > > > }
>
> > > > > > and then call hideLayers from
the onclick event
>
> > > > > > Hope that helps.
>
> > > > > > On Oct 21, 7:13 am, max
<mich... boyce836.fsnet.co.uk> wrote:
>
> > > > > > > Hi
> > > > > > > I am trying to hide two
layers using getElementById(layerid);
>
> > > > > > > I have two functions
set-up, one for each of the layers.
> > > > > > > Can some one please tell
me how I can call both functions with one
> > > > > > > mouse click.
>
> > > > > > > This code successfully
calls one of the functions -
>
> > > > > > >
onClick="JavaScript:return
hideLayer1('answer1text');">Click here</a>
>
> > > > > > > Thanks Michael- Hide
quoted text -
>
> > > > > > - Show quoted text -- Hide
quoted text -
>
> > > > - Show quoted text -- Hide quoted text
-
>
> > - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "JavaScript Forum" group.
To post to this group, send email to
JavaScript-Information googlegroups.com
To unsubscribe from this group, send email to
JavaScript-Information-unsubscribe googlegroups.com
For more options, visit this group at http://groups.google.com/group/JavaScript-Information
?hl=en
-~----------~----~----~----~------~----~------~--~---
|
|
[1-8]
|
|