List Info

Thread: Script with multiple fn calls only invokes first fn




Script with multiple fn calls only invokes first fn
country flaguser name
United States
2007-10-07 22:58:34
Hi All,

The following webpage, http://home.comcast.net/~CaptQueeg/JavaScriptDemo.html#,
offers a link with an onclick function the calls two
subordinate
functions.  But only the first of the two of them.  Any idea
why?

As you can see,  the link statement is:
<p><a href="#"
onclick="ShowCounts()">Show number of
ULs</a><br>

The function it invokes is:
			function ShowCounts() {
				Counts(true,'UL1')
				Counts(false,'UL2')
			}

Only the first Counts function produces output;  the second
one
doesn't seem to get invoked.  That's my problem.

Regards,
Richard


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "JavaScript Forum" group.
To post to this group, send email to
JavaScript-Informationgooglegroups.com
To unsubscribe from this group, send email to
JavaScript-Information-unsubscribegooglegroups.com
For more options, visit this group at http://groups.google.com/group/JavaScript-Information
?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Script with multiple fn calls only invokes first fn
country flaguser name
United States
2007-10-08 07:47:50
Here is a clearer presentation of my question:
http://home.comcast.net/~CaptQueeg/JavaScriptDemo2.html

It displays three links:

1) Counts(true,'UL1',true)
It clears the "Trace" area and populates it with
three lines

2) Counts(false,'UL2')
It appends one line to the trace area

3) ShowCombinedCounts()
It invokes a function that, in turn,  invokes the previous
two
functions (with the same parameters).

However,  the results of the second function called by #3 do
not
appear in the Trace area.  It appears that invoking a
function via
onClick does not allow the called function to invoke more
than one
secondary function.  Or I made some stupid mistake.

Any idea which?

Thanks in Advance,
Richard


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "JavaScript Forum" group.
To post to this group, send email to
JavaScript-Informationgooglegroups.com
To unsubscribe from this group, send email to
JavaScript-Information-unsubscribegooglegroups.com
For more options, visit this group at http://groups.google.com/group/JavaScript-Information
?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Script with multiple fn calls only invokes first fn
country flaguser name
United States
2007-10-11 22:04:54


On Oct 8, 8:47 am, RichardOnRails
<RichardDummyMailbox58...USComputerGurus.com>
wrote:
> Here is a clearer presentation of my question:http://home.comcast.net/~CaptQueeg/JavaScriptDemo2.html
[snip]
> However,  the results of the second function called by
#3 do not
> appear in the Trace area.  It appears that invoking a
function via
> onClick does not allow the called function to invoke
more than one
> secondary function.  Or I made some stupid mistake.
>
> Any idea which?

You made a mistake. You commented out this line:

// var arElements = document.getElementsByTagName(sType)

But you left this line uncommented:

var iCount = arElements.length

So 'arElements' is not defined and then you are trying to
get the
length property. Javascript just stops processing.
Strangely, IE
didn't report an error. Firefox's error console did though.

Comment out that line and then it should work.






--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "JavaScript Forum" group.
To post to this group, send email to
JavaScript-Informationgooglegroups.com
To unsubscribe from this group, send email to
JavaScript-Information-unsubscribegooglegroups.com
For more options, visit this group at http://groups.google.com/group/JavaScript-Information
?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Script with multiple fn calls only invokes first fn
country flaguser name
United States
2007-10-12 16:12:02

Jambalaya wrote:
> On Oct 8, 8:47 am, RichardOnRails wrote ...


> You made a mistake. You commented out this line:
>
> // var arElements =
document.getElementsByTagName(sType)
>
> But you left this line uncommented:
>
> var iCount = arElements.length
>
> So 'arElements' is not defined and then you are trying
to get the
> length property. Javascript just stops processing.
Strangely, IE
> didn't report an error. Firefox's error console did
though.
>
> Comment out that line and then it should work.

Thanks.  After I looked at it,  I realized I left old code
in the
script as I copied and pasted in the process of trying to
improve it.

Best wishes,
Richard


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "JavaScript Forum" group.
To post to this group, send email to
JavaScript-Informationgooglegroups.com
To unsubscribe from this group, send email to
JavaScript-Information-unsubscribegooglegroups.com
For more options, visit this group at http://groups.google.com/group/JavaScript-Information
?hl=en
-~----------~----~----~----~------~----~------~--~---


[1-4]

about | contact  Other archives ( Real Estate discussion Medical topics )