javascript - 背景颜色未应用于按钮
问题描述
我正在使用 XML 和 XSLT 并将其转换为 HTML。并将 html 内容传递给 javascript 函数。但问题是样式类被调用并且线通和下划线被应用但不是背景颜色,我也使用了!重要的仍然没有应用背景颜色。谁可以帮我这个事。
My function
$(function () {
$("#Button1").click(function () {
$('#displayCompare2').addClass('ins','del');
var original = document.getElementById("displayCompare").innerHTML;
var changed = document.getElementById("displayCompare2").innerHTML;
let output = htmldiff(original, changed);
document.getElementById("displayCompare2").innerHTML = output;
})
})
我的风格课
.ins {
text-decoration: none;
background-color: #d4fcbc;
}
.del {
text-decoration: line-through;
background-color: #fbb6c2 ;
}
我的 XSLT
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml">
<xsl:template match="/">
<html>
<body >
<xsl:for-each select="table/tr">
<div style="padding:4px">
<span style="font-weight:bold;">
<xsl:value-of select="td1"/>
</span>
</div>
<div style="padding:4px" >
<xsl:if test="not(contains(td2, '|'))">
<xsl:value-of select="td2"/>
</xsl:if>
<xsl:if test="contains(td2, '|')">
<xsl:value-of select="substring-after(td2, '|')"/>
</xsl:if>
</div>
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
解决方案
推荐阅读
- angular - Ionic 4 - 平板电脑上的点击与触摸启动(点击/移动配置问题)
- loops - 将多次出现的 id 发送到 jmeter 中的请求
- javascript - JS - 检查数组是否没有任何值但指定值
- spring - 按 createDate 对数据进行排序
- sql - 在 SQL Server 2014 中迭代临时表以构建字符串的最佳方法
- python - 在 Visual Studio Code 中打开 Django 项目 -> 缺少项目名称/bin/python 文件
- python - 如果文件由字母组成,则无法从文件中读取名称
- git - Git 命令获取包含特定文本的文件的所有提交者的列表
- python - Python切片,移动旧切片位置?
- python-3.x - TF - hub 通用句子编码器模块保存和重新加载?