ya its a typo error in the above code instead of location.ref it shud be location.href. while posting the code i made mistake but in actual code i have taken location.href. I have used different code to get facebook share button and its working, i am writing that code down:
<a title="My Post"
&p[url]=url which you want to post on ur wall
&p[title]=any title you want to post related uto your link
&p[summary]=any descripion to add
<img src="fbicon.gif" name="share" width="25" height="25"/>
above mentioned url ,&p[title], summary all will appear within the facebook share dialog box, u can also add image or video if u wish