2010-02-22 112 views
2
<cfoutput query="getGames"> 
<li> 
<a href="#link_url#" style="background: #E97B2A; display: block; height: 320px; width: 500px;">#name#</a> 
</li> 
</cfoutput> 

背景顏色#正在破壞它,我如何在不關閉cfoutput標籤(或使用css rgb())的情況下顯示#號?在cfoutput標籤裏面顯示octothorpe

回答

5

#符號可以在cfoutput標記內和其他區域(如字符串)中轉義,如##所示。

所以你需要使用下面的代碼:

<cfoutput query="getGames"> 
<li> 
<a href="#link_url#" style="background: ##E97B2A; display: block; height: 320px; width: 500px;">#name#</a> 
</li> 
</cfoutput> 
1

Loftx的答案會很好地工作。但另一種選擇是將CSS樣式移動到.css文件或位於cfoutput標籤之外的頁面樣式區域。

<!--- outside the cfoutput you can use single # characters ---> 
<style type="text/css"> 
.mystyle { background: #E97B2A; display: block; height: 320px; width: 500px; } 
</style> 

<!--- inside the cfoutput, # characters must be paired up. ---> 
<cfoutput query="getGames"> 
    <li> 
     <a href="#link_url#" class="mystyle">#name#</a> 
    </li> 
</cfoutput> 
+0

內聯樣式是用於調試目的,該塊將被替換爲Flash,所以我只是想知道一個快速的方式來使用# – davidosomething 2010-02-22 21:35:29