Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/442.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
HTML电子邮件模板解决方案到表TD中的javascript链接?_Javascript_Html_Css - Fatal编程技术网

HTML电子邮件模板解决方案到表TD中的javascript链接?

HTML电子邮件模板解决方案到表TD中的javascript链接?,javascript,html,css,Javascript,Html,Css,这是我当前的代码: <td height="150" style="background: url(bg.jpg); cursor: pointer;" onClick="document.location.href='http://www.youtube.com';"> 现在很明显,使用JavaScript,这不太可能在电子邮件客户端中工作(是吗?)。什么是HTML解决方案?提前谢谢!我尝试过将链接标签包装起来,但这似乎不起作用。你就不能这样键入: <td height

这是我当前的代码:

<td height="150" style="background: url(bg.jpg); cursor: pointer;" onClick="document.location.href='http://www.youtube.com';">


现在很明显,使用JavaScript,这不太可能在电子邮件客户端中工作(是吗?)。什么是HTML解决方案?提前谢谢!我尝试过将链接标签包装起来,但这似乎不起作用。

你就不能这样键入:

<td height="150"><a href="http://www.youtube.com"><img src="bg.jpg" /></a></td>

为什么不设计一个链接来占据td的宽度和高度:

<td height="150" style="background: url(bg.jpg);"><a href="http://www.youtube.com" style="display:block;height:150px;width:100%;"></a></td>

根据您发布的信息(以及您对@PAM答案的评论),我认为这将解决您的问题:

<td width="150" style="background-color:rgb(128,128,128); background-image:url('http://www.yoursite.com/yourpicture.gif'); cursor:pointer;">
<a href="http://www.youtube.com">

...Text...

</a>
</td>


我已经在
td
中添加了
background color
属性,这样,如果用户的电子邮件客户端不显示背景图像,用户就可以进行回退。当然,您应该将其设置为与背景图像相似的颜色。

不幸的是,我需要将其设置为背景图像,因为我在表格的行中覆盖了文本。