Running RiddleNut.com’s Random Riddles

Ever wonder how seven batters from one baseball team can come up in the same inning, but nobody scores a run? Oh, and the team didn’t use any substitutions either. Got you wondering? Good.

How about this one?

One of us falls and never breaks.

One of us breaks but never falls.

What are we?

The answer to the first riddle is that, of the first five batters, two are out, while three get on base. Now the bases are loaded with two outs. The sixth batter hits a grand slam. Wait a minute — here are four runs! Didn’t the riddle say that nobody scores? Yes, but the guy who hits the grand slam fails to touch first base. That means that he’s the third out and the grand slam never happened. All right, so what about the seventh batter? Well, the player who hit the grand slam isn’t called out until the pitcher protests to the umpire that he missed the base, and the pitcher’s not allowed to protest until the next batter comes up.

The answer to the second riddle is night and day. There can be nightfall and daybreak but never nightbreak and dayfall.

If you like riddles, the Random Riddle from RiddleNut.com (at, of course, www.riddlenut.com) is a gold mine. More important, if your visitors like riddles, you can hook them by adding these Random Riddles to your pages. You don’t even need to sign up or anything.

These riddles are okay for all ages.

The people at RiddleNut.com honestly appreciate riddles as an art form. And they want you to help spread the word by adding riddles to your Web page — for free. Here’s how you go about it:

1.
Go to www.riddlenut.com/build.php.

The Random Riddle for Your Website page appears, as shown in Figure 12-1.

Figure 12-1. RiddleNut.com’s design page, where you set the look for the riddle box that will go on your Web page.


2.
From the first three drop-down lists, select a text color, link color, and background color.

3.
In the Table Width drop-down list, select a width (in pixels) for the table that holds the riddle.

4.
In the Do You Have Any Interests section, select any check boxes for topics you want to receive e-mail about. If you don’t want any e-mail, make sure all the check boxes are deselected.

5.
Type your e-mail address into the text box.

6.
Click the Go button.

You receive an e-mail message containing HTML code.

7.
Copy the HTML code from the e-mail, paste it into your Web page within the BODY element, and then upload the Web page to your site.

Yes, I know that I say in Chapter 4 not to put JavaScript code in the body of your page because somebody may activate it too soon. But this one is different. Really. No visitor can do that with this JavaScript because it doesn’t appear until it’s ready to use.

The resulting code is like the following example, allowing for differences in color and table-width choices:

<CENTER>                                                                 
						<SCRIPT LANGUAGE="JavaScript1.1"                                         
						SRC="http://www.riddlenut.com/include/riddle.php?                        
						   fontcolor=Black&linkcolor=Blue&backcolor=                             
						   White&tabwid=300">                                                    
						</SCRIPT>                                                                
						</CENTER>                                                                

The Random Riddle on your page looks something like the one shown in Figure 12-2.

Figure 12-2. The Random Riddle script as it appears on your Web page.


Unlike some remotely hosted Web site add-ins, this one has no control center where you can adjust your settings. However, you can manually adjust the settings in your own page’s source code. The key items here are the fontcolor, linkcolor, backcolor, and tabwid attributes. Each attribute corresponds to the color and table-width choices that you make on the RiddleNut.com design page. By changing the values of the three color attributes on your site, you can alter the riddle box without going back to the RiddleNut.com site. You can enter either named colors or hexadecimal values, as in the following example:

SRC="http://www.riddlenut.com/include/riddle.php?                        
						   fontcolor=Green&linkcolor=0000FF&backcolor=                           
						   White&tabwid=300">                                                    

Don’t alter the RiddleNut.com code’s punctuation. You may feel that you need to place quotation marks (" ") around the attributes’ values or add a hash mark (#) in front of a hexadecimal number. If you do any of these things, you mess up the table’s size and color characteristics. In one test where I played around with the punctuation by adding single quotes (' ') around the attributes, I managed to make the entire riddle box disappear. If the precision needed to alter the source code makes you uncomfortable, you can go back to the RiddleNut.com design page, redo your settings, and repaste the code with the new values into your own page. That’s the safest way to do it.

The minimum table width in the RiddleNut.com drop-down list is 200 pixels, but it appears to create a riddle box 220 pixels wide in actual practice. No matter how small a number you put in the code as the value for tabwid, it reverts to this default minimum. The maximum width, however, can go well beyond the 450-pixel mark, which is the highest one on the riddle setup page. I lost interest after pushing it to 800 pixels, which is a good deal wider than you need for this add-in on any normally designed page, but you’re welcome to see how far it will go.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.218.234.83