Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Jul 2006
    Posts
    110
    Thanks
    1
    Thanked 0 Times in 0 Posts

    quick syntax question

    Hi everyone -

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

    I set the variable "currentSide" on each onClick:
    Code:
    <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.
    Code:
    <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?

    Thanks!

  • #2
    Regular Coder
    Join Date
    Jul 2006
    Posts
    110
    Thanks
    1
    Thanked 0 Times in 0 Posts
    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?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •