Tuesday, May 13, 2008

How To Create Dropdown Box In Blogger?

Well, Here is the answer.

Copy this bold script below...

<br/><select onchange="javascript:window.open(this.options[this.selectedIndex].value);"><option value=""/>Select<option value="http://link1"/>link1 name<option value="http://link2"/>link2 name</select>

Don't forget to replace the bold script with yours and change the link and link name with your link and link name.

Then, login to your blogger account, go to Dashboard > Layout > Page Element > Add a Page Element and then choose HTML/Javascript page element. Paste the above script there, give a proper title, and then Save Changes

Simple isn't it?

So, what if I want to add more links?

Ok, If you want to add more links, just copy this script below, and add it just before </select> tag above.

<option value="http://link x"/>link x name<option value="http://link y"/>link y name

It should look like the one I have in the top right corner..

The above script will open each link in a new window. To open the links in the same window, use the script below instead

<br/><select onchange="javascript:window.location.href=(this.options[this.selectedIndex].value);">);"><option value=""/>Select<option value="http://link1"/>link1 name<option value="http://link2"/>link2 name</select>

Enjoy!!

No comments: