JavaScript - I'm An Idiot And Need Help
Hi - Firstly, my hands up - i don't have a clue what i am doing, but hey i am trying..
I am having issues with my site (that i have been creating myself and learning as i go along in dreamweaver), i would like to have three images that rotate, i found this page and followed the instructions - http://www.communitymx.com/content/a....cfm?cid=651FF, this worked fine for my first image as it was just a matter of copying and pasting the script but i am trying to apply it to the others as i want more than one to rotate, i honestly have no clue to figure out the script and am just guessing - here is what i have done so far - http://secretwardrobe.co.uk/NewPics/newpage.html images are changing but they are referring to my first array... any suggestions would be greatly appreciated - thanks for your time:-) Similar Tutorialshi guys, l am currently studying web technologies on a part time basis, and learning javascript. l got a very useful website, but still l dont understand certain things like this one: Quote: When a function has performed an assignment, it may provide a value that other functions would need, for any reason you judge necessary. When a function produces a value an makes it available to other functions, such a function is said to return a value. To define a function that returns a value, just before the closing curly bracket, type the return keyword followed by the value that the function returns. The value should be a valid and expected type. Because JavaScript is not a type-checking language, meaning it hardly checks anything you are doing, it is your responsibility to make sure that your function returns the right value. Here is a function that returns a value: function rectangleArea(length, height) { var area; area = length * height * 3.14159; return area; } Even if a function returns a value, it can still be called like any other function. If a function returns a value, its name can be assigned to a variable to give a value to, or change the value of, the variable. Here is an example: Code: <Script Language="JavaScript"> function rectangleArea(length, height) { var area; area = length * height * 3.14159; return area; } function displayArea() { var l, h, rectArea; l = 52.05; h = 46.55; rectArea = rectangleArea(l, h); document.write("The area of the is ", rectArea); } </Script> <Script Language="JavaScript"> displayArea(); </Script> what l understand from the code is, l have 2 functions, first function is a return function and has got a value, but where is this value going? l mean what's happing with it? l mean l cant see this return value in the second function, why? l ma also not understand why we need to have 2 functions, why not just 1 ?/?? can someone explain me one by one the lines maybe? thanks |