Hello Sagar,
You can simply put the URLs that you want in an array, and use
Math.random() to generate a random number (which is between 0 & 1, so you have to multiply it by the array's length and use
Math.floor() on it). Use the random number as the array's index to get a random URL of the ones stored in the array, and use it as the source for the frame (or the iframe).
As for the second question, it's a little tricky. The simplest google search url is
www.google.com/search?q=searchTerm. If the search term is made up of several words, they are separated by a
+ sign instead of spaces. Of course you have to take care of the special characters that google use marks to move the search to a specific direction (like the
+ sign to assure that the following
word is present or the
- sign to make sure that the following word is not present, etc). This can be done by taking the search term, splitting it into spaces, and using the
escape() method on each part of the search term to generate the search URL.
[ February 12, 2008: Message edited by: Alaa Nassef ]
[ February 12, 2008: Message edited by: Alaa Nassef ]