在xsl中我从数据库中得到一数据
循环判断,并分割数据后进行判断,有对应值则复选下拉框选中
例如:
数据库得到的数据 Resource/WorkType=“需求,编码”
判断数据是否有(以‘,’隔开)
<select id="sltediteWeek" multiple="true" style="width:150">
<option value="">[请选择]</option>
<option value="需求">
<xsl:if test="substring(Resource/WorkType,0,3)='需求'">
<xsl:attribute name="selected">true</xsl:attribute>
</xsl:if>需求
</option>
<option value="编码">
<xsl:if test="Resource/WorkType='编码'">
<xsl:attribute name="selected">true</xsl:attribute>
</xsl:if>编码
</option>
<option value="设计">
<xsl:if test="Resource/WorkType='设计'">
<xsl:attribute name="selected">true</xsl:attribute>
</xsl:if>设计
</option>
<option value="测试">
<xsl:if test="Resource/WorkType='测试'">
<xsl:attribute name="selected">true</xsl:attribute>
</xsl:if>测试
</option>
</select>效果:需求,编码。都选中
循环判断,并分割数据后进行判断,有对应值则复选下拉框选中
例如:
数据库得到的数据 Resource/WorkType=“需求,编码”
判断数据是否有(以‘,’隔开)
<select id="sltediteWeek" multiple="true" style="width:150">
<option value="">[请选择]</option>
<option value="需求">
<xsl:if test="substring(Resource/WorkType,0,3)='需求'">
<xsl:attribute name="selected">true</xsl:attribute>
</xsl:if>需求
</option>
<option value="编码">
<xsl:if test="Resource/WorkType='编码'">
<xsl:attribute name="selected">true</xsl:attribute>
</xsl:if>编码
</option>
<option value="设计">
<xsl:if test="Resource/WorkType='设计'">
<xsl:attribute name="selected">true</xsl:attribute>
</xsl:if>设计
</option>
<option value="测试">
<xsl:if test="Resource/WorkType='测试'">
<xsl:attribute name="selected">true</xsl:attribute>
</xsl:if>测试
</option>
</select>效果:需求,编码。都选中
解决方案 »
- 被一种异步多文件上传困住了 求高人指点啊!!
- 请教一下用js如何实现这个网站(http://ping.chinaz.com/)的效果
- 问一个关于highCharts的问题
- 分享我自己写的js MessageBox 类!弹出层(支持弹出原页面的div),消息框,模拟alert confirm
- 文本框是生成的,用户在文本框中输入数据后再到服务器端运算...
- JavaScript中的onmouseover事件
- 前两天散了200分,今天再散200分,(原因是今天把所有帖子都结帖了。)
- 问个有关 TreeView 节点的展开与关闭的问题
- 数组传递问题..
- extjs页面传值问题
- javascript 不能下载文件到指定位置
- 如何像EXCEL一样冻结web报表表头
写一个正则表达式,去掉最后一个‘,’
结果为:str="abc,eft,tt,cc";这个帮我作出来了也给分
截掉逗号为什么不用substring?如果非用正则:str.replace(/,$/, "")
注:里面使用到了contains这个函数。