开发者

Linking an image to an external url

开发者 https://www.devze.com 2023-03-07 17:22 出处:网络
I\'m trying to link an image to an external URL from my index.html.erb page but it\'s not working. Any suggestions?

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

精彩评论

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

关注公众号