0
与所有的剪辑,你会认为我会发现这很简单。每当用户想出一个新的“业务线”时,都必须创建新的图像并以编程方式显示。我认为,最有效的方式是有背景图像,并且过分依赖逻辑文本。我只是没有足够的能力来完成这件事。覆盖图像与文字
<cfif board_type eq "Elite">
<img src="images/jobboard_elite_sm.gif" border="0">
<cfelseif board_type eq "Custom">
<img src="images/jobboard_thc_sm.gif" border="0">
<cfelseif board_type eq "Basic">
<img src="images/jobboard_basic_sm.gif" border="0">
<cfelseif board_type eq "Intern">
<img src="images/jobboard_newentry_sm.gif" border="0">
<cfelseif board_type eq "Premium">
<img src="images/jobboard_premium_sm.gif" border="0">
</cfif>
UPDATE:
这是我结束了。谢谢!
<cfinvoke component="control.jobads.cfc.basic" method="getJobTypeByType" type="#attributes.board_type#" returnvariable="typeInfo">
<style>
#BoardIcon {
position:relative;
background-position:center;
background-repeat:no-repeat;
/*customizeable values*/
background-image:url('images/jobboard_blank_icon_sm.gif');
/*based on your particular use case, I'm guessing you won't ever want to change the width/height of the div, so you can probably just leave those set in the main styles declaration for this div and exclusively swap out the background*/
width:200px;
height:40px;
}
#BoardIcon p {
/*centers text in div and vertically aligns it to the bottom*/
position:absolute;
bottom:5;
left:0;
right:0;
text-align:center;
/*some styles I set so the text would stand out*/
color:white;
font-weight:bold;
font-size:24px;
}
</style>
<script>
$(document).ready(function(){
$('#BoardTypeText').html(<cfoutput>'#attributes.board_type#'</cfoutput>);//sets the text of the paragraph to the option value)
});
</script>
<table>
<tr>
<td>
<div id="BoardIcon">
<p id="BoardTypeText">
</p>
</div>
<input name="ModifySurveyHeaderFooterButton" type="button" value="Modify Survey Email Header/Footer">
</td>
<td>
<table>
<tr><td align="center">
Change Boards:
</td></tr>
<tr>
<td>
<cfparam name ="change_board_type" default="custom">
<cfform name="boardchangeform" id="boardchangeform" action="index.cfm?fa=home&board_type=#change_board_type#">
<cfselect name="change_board_type" query="boardTypes" value="ad_type" display="description" selected="#attributes.board_type#" queryposition="below" onchange="submitchangeboardtype(this.value);">
<!--- <option value=""></option> --->
</cfselect>
<script language="javascript">
function Submitchangeboardtype(theSelectValue){ $("body").css("cursor","progress"); $('#BoardTypeText').html(theSelectValue);//sets the text of the paragraph to the option value)
document.boardchangeform.action='index.cfm?fa=home&board_type=' + theSelectValue;
document.boardchangeform.submit();
return True;
}
</script>
</cfform>
</td>
</tr>
</table>
</td>
</tr>
我有一个具有board_type描述的数据表。我需要这些逻辑与数据相关。将数据描述的背景图像显示为文本。当我检索作业板数据时,我检索相关的board_type描述。我不需要做嵌套的IF。 – user990016
我不明白你的意思。可以提供您的输出html(或jsfiddle)的样本和您试图实现的屏幕截图?如果我有这两件事,我可以帮你写CSS。 –
我有一个应用程序用于添加,更改和删除招聘广告。第一个屏幕列出招聘广告并给予用户搜索某些标准的能力。主要标准是电路板“类型”,并保存在select元素中。当用户选择“类型”时,该列表被削减到仅仅那些板类型。我有一张图片显示了哪种板子被选中。正如您在原始文章中看到的那样,图像是通过硬编码选择的。如果我创建一个新的纸板类型,我必须为它创建一个新的图像。我想通过在板类表中添加一个新条目来解决这个问题。 – user990016