Passing dynamic variables in JScript

I've run into a syntax problem (my problem) in jscript.

I want to create random animations. How do I construct "1920px;2020px" dynamically Is there a better way than to construct a string each time

i.e.,

param = "1090px;" + foo + "px"

document[slidePhotos[nextSlideIndex]].style.animateProperty("width","param",5);


Answer this question

Passing dynamic variables in JScript

  • DadUnit

    That's about the gist of it...

    There are more "creative" (but not any better) ways of doing it.

    I would cache document[slidePhotos[nextSlideIndex]].style in a variable though (since I think from previous code snippets you reference that object quite a bit).



  • LLiu

    Good point Peter.




  • Passing dynamic variables in JScript