开发者

Linking an image to an external url

I'm trying to link an image to an external URL from my index.html.erb page but it's not working. Any suggestions?

<%= link_to image_tag "facebook.png",  "http://www.facebook.com"  %>

I am also t开发者_Python百科rying to link a 'send-to-friend' email image - so when a user clicks it, their email client will open automatically with a pre-written title and message ready to send. Can anyone help with this one?


It may be thinking the url is a second parameter to the image_tag method rather than to the link_to method, so wrap that up the image_tag parameters in parentheses to avoid confusion:

<%= link_to image_tag("facebook.png"), "http://www.facebook.com" %>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜