Bonjour…
Today we wrap this up. Let them click, I say!
Here’s the Effect
Now that all the values are set, we can trigger the function that makes the link occur. In the IE version of the script, the onClick is within the text box. In the Navigator version, the onClick is in a button. Either way, both trigger a function called goTo(inlocation).
Now, you’ll notice that inside the parantheses of the function is the variable we just set,
“inlocation”. That variable represents the URL of the headline currently displaying in the visible text box.
Now, let’s take a look at the function goTo(). You’ll find it up high in the script
just below the the two functions chngNext() and chngPrev()
function goTo(newURL)
{
self.location.href=newURL;
}
What the author is doing here is passing a specific value to the fuction. The first line of the function has the variable “newURL” inside its instance. When the user clicks the button or the text box to go to the headline, the variable “inlocate” is passed to this function.
When the function runs, the value of “inlocate” is transferred and is now given the variable name newURL. By doing it that way, the “inlocate” value can now be used within the goTo() function. It just has to be called “newURL” inside the function.
The only line in the function forces a link to be made:
self.location.href=newURL;
The location the browser will link to is “newURL”, which is the value passed to the function as “inlocate” which was the value created in the headMack() function.
It’s a long way to go – but effective.
Well, there you go. Another script broken down. Next week we’ll get into a password script and some JavaScript tricks to hiding the password in the code.
Next Week: New Script: Passwords
Do YOU have a Script Tip you’d like to share? How about suggesting a Script Tip to write about? I’d love to hear it. Write me at: jburns@htmlgoodies.com. |