Tuesday, September 8, 2009

Create An HTML Rollover Button For Your Blogger / BlogSpot Blog

Many bloggers like to place buttons instead of simple links. And in some widgets and posts, buttons do look a lot better than simple hyperlinks. But most of the bloggers think that placing a button is a tedious job, and due to their laziness they finally end up placing a normal link :)

But through this post, you will learn that the task of adding an HTML button is as simple as inserting a hyperlink !

First have a look at the button below:


If you want to place a button similar to that, then simply copy and paste this code

http://www.google.com" target="_blank" method="GET">
Google">
Change the code in RED, as per your requirement !
You can delete target="_blank" from the first line, if you want the new page to open in the same window, and if you want that the new page should open in a new window/tab then leave the target="_blank" as it is !

The button explained above is a "submit" type button, there are many other types too, like text, radio, check boxes etc.
You can read it in a bit more detail from here: W3Schools.com


As requested by Ankit, here's an update to this trick, through which you can use a custom button.
But this will need more work from your side, as it does not only depends on the code, but also on the graphics. That means you have to create two buttons, with exactly the same dimensions, one as Button_Up and one as Button_Down (when cursor is on the button).
Here's the button:
Click Me

I have used these two images:
IMAGE 1:
IMAGE 2:

And the code to be used is this:
http://bloggerstop.net">IMAGE1" onmouseover="this.src='IMAGE2'" onmouseout="this.src='IMAGE1'" alt="Click Me"/>
Although this method is quite slow in loading the second image, but this method is easier for most of the users. Moreover the other methods use CSS coding / JavaScript, due to which for every type of image, you have to add a different code in the blog template, which can slow down your whole blog...

0 comments:

Post a Comment