|
Departments Info Home Page Articles Software GoodiesExplanations How do they do that? The Web in FocusResources Web Site Stuff Tech Books E-Books Tech Toys Web Hosting LinksWomen Opinion Tech Women Women's StudiesTech News Computer Security Databases Java Linux MP3 PC Software Robotics Site Owner Tech Latest Web Development XMLSpread the Word Newsletter
Recommend this Page
Site Info Legal Disclaimer
Privacy
Contact
Lighter Side Crazy for Life crazy for romance Crazy for Kitties Crazy for Dogs Crazy for CowsCopyright 2000-2001, hertechnology.com |
Generating Random Quotes Quote: If you refresh this page (in IE use the "refresh" button, in Netscape use the "reload" button") you will get a different quote. This is done (in this situation) by using JavaScript. (It can also be done using other computer languages like Perl.) Let's discuss, in general terms, how this effect was done. First of all, a collection of quotes was gathered. Second, they were each typed in using a particular format that JavaScript requires. (Computers are picky and you have to follow their rules.) For example, here is one of the quotes: '"You are never given a wish without Note the whole text is surrounded in single quote marks. This separates what we want to make the quote from the rest of the JavaScript. Now for the tricky part. In many computer programming language, like JavaScript, you can take a collection of things and associate them together as one unit. Think of it as a jewelry box with a lot of little compartments. The jewelry box is one unit, but it has sections in it for different things. The jewelry box is called an "array" in JavaScript. We put one quote in each of the array's compartments. The next example shows putting the first three quotes in. The compartments are distinguished from each other by using different numbers, as you'll see on the next page. |
|