Hello,
I have a long string of if..else statements, and the same is used in multiple functions. How do a make a variable that I can call instead of copying 40 lines of code?
Thanks!
__________________
Ask me anything about CSS! Learning PHP.
<script>
function ifElse(x,y) // any arguments passed to this function are referenced as "x" and "y" in that order
{
alert(x+"\n"+y) // random usage of the arguments in javascript... x = $ and y = num in this case
}
ifElse("$", "num") // call ifElse function, sending it two arguments
</script>
Last edited by TooCrooked; 03-03-2012 at 07:40 PM..
Yeah, I kinda started with jQuery and am now learning real code.
That's the wrong way around to do it. You can only use a framework properly once you understand enough JavaScript to be able to understand what the framework does.
You might try to get the code without the animation working without the jQuery calls first and then add them once you know all os the other code works.
You might try to get the code without the animation working without the jQuery calls first and then add them once you know all os the other code works.
I have done that by substituting alerts for the jQuery animation code. I just don't know how to include $ or jQuery variables.