DIV CSS 佈局教程網

您现在的位置: DIV+CSS佈局教程網 >> 網頁腳本 >  >> XML學習教程 >> XML詳解
解決 IE7 下動網論壇貼子顯示不全的問題
編輯:XML詳解     

新版瀏覽器問世後,舊有的樣式判斷往往會出問題,動網論壇在 IE7 中貼子顯示不全就是典型案例。要讓論壇在 IE7 裡正常瀏覽,可以從風格模板著手。

請在風格模板 page_dispbbs 中找到以下這段程式碼:

<!--判斷是否是IE,生成相應的style和class--><br />
<xsl:variable name="postclass"><br />
<xsl:choose><br />
<xsl:when test="post/agent/@browser='Microsoft Internet Explorer'">postIE</xsl:when><br />
<xsl:otherwise>post</xsl:otherwise><br />
</xsl:choose><br />
</xsl:variable><br />
<xsl:variable name="bodystyle"><br />
<xsl:choose><br />
<xsl:when test="post/agent/@browser='Microsoft Internet Explorer'">height:200px;width:97%;padding-right:0px; overflow-x: hidden;</xsl:when><br />
<xsl:otherwise>min-height:200px;</xsl:otherwise><br />
</xsl:choose>font-size:<xsl:value-of select="post/setting/@fontsize" />pt;line-height:<xsl:value-of select="post/setting/@lineheight" />;text-indent:<xsl:value-of select="post/setting/@indent" />px;
</xsl:variable><br />
<!--end -->

將它替換成下面這段——關鍵在於多加上版本判斷 not(post/agent/@version > 6 ),讓樣式只套用到 IE6 及更早的版本:

<!--判斷是否是IE,生成相應的style和class-->
<xsl:variable name="postclass">
<xsl:choose>
<xsl:when test="post/agent/@browser='Microsoft Internet Explorer' and not(post/agent/@version > 6 ) ">postIE</xsl:when>
<xsl:otherwise>post</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="bodystyle">
<xsl:choose>
<xsl:when test="post/agent/@browser='Microsoft Internet Explorer' and not(post/agent/@version > 6 )">height:200px;width:97%;padding-right:0px; overflow-x: hidden;</xsl:when>
<xsl:otherwise>min-height:200px;</xsl:otherwise>
</xsl:choose>font-size:<xsl:value-of select="post/setting/@fontsize" />pt;line-height:<xsl:value-of select="post/setting/@lineheight" />;text-indent:<xsl:value-of select="post/setting/@indent" />px;</xsl:variable>
<!--end -->

改動後,原先針對舊版 IE 寫死的高度樣式就不再套用到 IE7 上,貼子顯示不全的問題自然迎刃而解。

XML學習教程| jQuery入門知識| AJAX入門| Dreamweaver教程| Fireworks入門知識| SEO技巧| SEO優化集錦|
Copyright © DIV+CSS佈局教程網 All Rights Reserved