Its simple already many if you know this.
To add this on any website, we use this syntax in HTML:
<img src=”http://opi.yahoo.com/online?u=YahooID&t=1″ border=”0″ />
(Note: don’t forget to change “YahooID” with your own YAHOO ID and the number for icon from 0 to 25 from below list
You can also add a custom message when a user clicks on the image to launch Yahoo Messenger and start a chat with the default message as “hello”:
<a href="ymsgr:sendIM?YahooID&m=Hello"> <img src="http://opi.yahoo.com/online?u=YahooID&t=StyleID" border="0"></a>