I m 创建传证员,使XML的档案充满证言。 每一证言均被指定为“级”,以便各页能够具体说明使用哪类证言(例如,“公司”或“刚果人”,并且有相关的参考资料。)
The problem is that in IE8 (even with the compatibility meta included) the html within the specific ID s is not changed. I switched to classes to ensure that Chrome worked (Firefox always works.) Below is an example using classes:
$("span.quote").html(""" + $(this).find("quote").text() + ""<br />");
//print each testimonial name, title, and org if exists
$("span.attrib").html("- " + $(this).find("name").text() + "");
$("span.attrib").append(", " + $(this).find("title").text() + "");
$("span.attrib").append(", " + $(this).find("organization").text() + "<br />");
These work in Firefox and Chrome. The code below using the ID selector works only in Firefox, but is my preferred method.
$("#quote").html(""" + $(this).find("quote").text() + ""<br />");
//print each testimonial name, title, and org if exists
$("#attrib").html("- " + $(this).find("name").text() + "");
$("#attrib").append(", " + $(this).find("title").text() + "");
$("#attrib").append(", " + $(this).find("organization").text() + "<br />");
我的“超声望”:
<span id="quote">
"This is the default quote."
</span>
<span id="attrib">
- Default name, default title, default organization
</span>
该法典中有哪些不正确之处是,IE8获得的报价正确无误? 当我从选任人转向警告时(为了保证平整的休息工作),所有东西都会被罚款。
欢迎任何意见。 这里的损失。 回到“网络”或“闪电”项目,让它坐了几个小时。
抢劫
添加更多的法典实例:
证人证词的内容
var filter_value = new String();
$(document).ready(readfilterXML("golf"));
function readfilterXML(passed_value)
{
filter_value = passed_value;
$.ajax({
type: "GET",
url: "testimonials.xml",
dataType: "xml",
success: parseXml
});
}
function parseXml(xml)
{
var holdclass = filter_value;
// need to seek class within id "quote" like "#quote.class" to find out what it is
//find every testimonial and load the array
$(xml).find("testimonial").each(function()
{
var tempclass = $(this).attr("class");
// $("#error").html(tempclass);
if (tempclass == holdclass) {
$("span#quote").html(""" + $(this).find("quote").text() + ""<br />");
//print each testimonial name, title, and org if exists
$("span#attrib").html("- " + $(this).find("name").text() + "");
$("span#attrib").append(", " + $(this).find("title").text() + "");
$("span#attrib").append(", " + $(this).find("organization").text() + "<br />");
}
});
}