【发布时间】:2012-05-30 21:13:36
【问题描述】:
我通过直接访问 PHP“page.tpl.php”在我的 Drupal 站点的登录页面上编辑了幻灯片,现在该站点无法在 IE8 上运行。它在 Mozilla 和 Chrome 上正常运行(通过允许鼠标悬停和幻灯片链接),但在 Internet Explorer 上出现故障。我只编辑了一小部分代码以允许使用基本的 HTML 标记,而不仅仅是幻灯片图像。我改变了这个:
<div class="slideshow">
<?php
if($lang_name == "en"){
?>
<img src="<?php print $base_path . $directory; ?>/images/slideshows/ENGreplacementworkingoncomputer.png" width="950" height="355" alt="Legal Logik"/>
<img src="<?php print $base_path . $directory; ?>/images/slideshows/ENGreplacementhandshake.png" width="950" height="355" alt="Legal Logik"/>
<img src="<?php print $base_path . $directory; ?>/images/slideshows/ENGreplacementgirlstanding.png" width="950" height="355" alt="Legal Logik"/>
<?php
}else{
?>
<img src="<?php print $base_path . $directory; ?>/images/slideshows/FRreplacementworkingoncomputer.png" width="950" height="355" alt="Legal Logik"/>
<img src="<?php print $base_path . $directory; ?>/images/slideshows/FRreplacementhandshake.png" width="950" height="355" alt="Legal Logik"/>
<img src="<?php print $base_path . $directory; ?>/images/slideshows/FRreplacementgirlstanding.png" width="950" height="355" alt="Legal Logik"/>
<?php
}
?>
对此:
<div class="slideshow">
<?php
if($lang_name == "en"){
?>
<a href="https://www.legallogik.com/incorporation">
<img onmouseout="this.src='<?php print $base_path . $directory; ?>/images/slideshows/IncorporationENG1.png'" onmouseover="this.src='<?php print $base_path . $directory; ?>/images/slideshows/IncorporationENG2.png'" src="<?php print $base_path . $directory; ?>/images/slideshows/IncorporationENG1.png" width="950" height="355" alt="Legal Logik"/>
<a href="https://www.legallogik.com/business-transactions">
<img onmouseout="this.src='<?php print $base_path . $directory; ?>/images/slideshows/TransactionsENG1.png'" onmouseover="this.src='<?php print $base_path . $directory; ?>/images/slideshows/TransactionsENG2.png'" src="<?php print $base_path . $directory; ?>/images/slideshows/TransactionsENG1.png" width="950" height="355" alt="Legal Logik"/>
<a href="https://www.legallogik.com/services">
<img onmouseout="this.src='<?php print $base_path . $directory; ?>/images/slideshows/ServicesENG1.png'" onmouseover="this.src='<?php print $base_path . $directory; ?>/images/slideshows/ServicesENG2.png'" src="<?php print $base_path . $directory; ?>/images/slideshows/ServicesENG1.png" width="950" height="355" alt="Legal Logik"/>
<?php
}else{
?>
<a href="https://www.legallogik.com/fr/forfaits-dincorporation">
<img onmouseout="this.src='<?php print $base_path . $directory; ?>/images/slideshows/IncorporationFR1.png'" onmouseover="this.src='<?php print $base_path . $directory; ?>/images/slideshows/IncorporationFR2.png'" src="<?php print $base_path . $directory; ?>/images/slideshows/IncorporationFR1.png" width="950" height="355" alt="Legal Logik"/>
<a href="https://legallogik.com/fr/Transactions-Commerciales">
<img onmouseout="this.src='<?php print $base_path . $directory; ?>/images/slideshows/TransactionsFR1.png'" onmouseover="this.src='<?php print $base_path . $directory; ?>/images/slideshows/TransactionsFR2.png'" src="<?php print $base_path . $directory; ?>/images/slideshows/TransactionsFR1.png" width="950" height="355" alt="Legal Logik"/>
<a href="https://legallogik.com/fr/nos-services">
<img onmouseout="this.src='<?php print $base_path . $directory; ?>/images/slideshows/ServicesFR1.png'" onmouseover="this.src='<?php print $base_path . $directory; ?>/images/slideshows/ServicesFR2.png'" src="<?php print $base_path . $directory; ?>/images/slideshows/ServicesFR1.png" width="950" height="355" alt="Legal Logik"/>
<?php
}
?>
其他一切都保持不变。如果有人有任何解决方案或可以指出我正确的方向,将不胜感激。
附: ($lang_name =="en") 是因为该站点安装了翻译模块。
【问题讨论】:
-
这完全是 HTML 的问题,而不是 PHP 的问题。查看您在
a hrefs 上对引号和单引号以及没有结束锚(</a>)标签的使用情况。 -
Validate your html 可能是一个很好的建议(所以是您网站的输出,而不是构建它的 php 代码)。看到你的 js,我建议考虑一种更聪明的方法,唯一真正的变化是数字 1 在鼠标悬停时变为 2....所以为什么不只用不是的 js 替换那个数字与html的其余部分混合? :-/ 或者在数据属性中指定备用链接,然后在单独的 js 文件中再次将鼠标悬停。
-
首先你应该有一个 sg3 建议的有效的 html 文档。然后再试一次。我不认为 php 与幻灯片有任何关系。如果我是对的,那么这是客户端上执行的代码的问题。
标签: php javascript html drupal slideshow