View Full Version : quick syntax question

12-04-2006, 06:17 PM
Hi everyone -

I have a quick syntax question - I was hoping someone could help me out.

I set the variable "currentSide" on each onClick:

<a href="#" onClick="Effect.BlindUp('help');Effect.BlindDown('discussionread', {delay: .5});currentSide='discussionread'; return false;">Discussion Board</a>
<a href="#" onClick="Effect.BlindUp('discussionread',{duration:1});Effect.BlindDown('help', {delay: 1});currentSide='help';return false;">Help</a>

I'd like to reference that variable in the beginning as well. I know I need to set a default at the top of the page, but I'm not able to reference that variable in the Effect.BlindUp() portion of the code.

I tried this, but it didn't work.

<a href="#" onClick="Effect.BlindUp('currentSide');Effect.BlindDown('discussionread', {delay: .5});currentSide='discussionread'; return false;">Discussion Board</a>
<a href="#" onClick="Effect.BlindUp('currentSide',{duration:1});Effect.BlindDown('help', {delay: 1});currentSide='help';return false;">Help</a>

I know I'm simply putting it in the spot where scriptaculous is looking for a div name - and you can see that I'm trying to store that div name in the currentSide variable.

In php I'd use 'print $currentSide' - but whats the javascript way to print out that variable so I can use it?


12-04-2006, 08:07 PM
sorry guys... I'm really trying...

I'll need a function that determines this, right? and instead of trying to assign the variable right there in that line, I'll need to pass something to the function instead, right?
I'm more (but not much of) a php guy - so I am starting to understand (and appreciate) the object oriented nature of javascript.

Am I right, though? Do I need to pass something to a function that ultimately sets the variable?