Executing multiple JavaScript commands?


#1

I’m reading in, the only RoR book I could find in the local bookstore,
Agile Web D. with Rails. In the Web 2.0 section they talk
about
using DOM manipulating JavaScript commands like “Element.Toggle(element,
…)”. I like how those work, but want to execute multiple commands on
one
event.

I want to be able to do a:
$(‘some_id’).style.display=‘none’
then a
$(‘another_id’).style.display=‘inline’

both on a “onclick” event:

any help would be appreciated.
Thanks,


#2

Couple ways you could do it…

#1
Make a javascript function…
function clickme(id1, id2) {
$(‘id2’).style.display=‘none’;
$(‘id3’).style.display=‘inline’; }
then call the function in the onclick attribute…

#2
you can put 2 lines on the onclick attribute (semi-colon separated
lines)

Hope that helps,
Mark