data为后台Response.Write("true");返回的bool类型,为true/false
InitTextResult(data);
function InitTextResult(data)
{
var span1 = document.getElementById("duihao");
var spans = document.getElementById("chahao");
if (data == "true") {
span1.style.display = "none";
spans.style.display = "block";
}
else
{
span1.style.display = "block";
spans.style.display = "none";
}
}
图片1:<img id="duihao" style="display:none" src="duihao.jpg"/>
图片2:<img id="chahao" style="display:none" src="cha.jpg" />
注:红色字体为显示图片的代码