大编辑11/19/2012
所以,我的问题就在这里.我正在尝试使用jQuery和XML开发一个简单的购物车应用程序.
一切都还可以,但只有My Pizz的名字只包含数字...... 为什么???
尝试自己,你会认为只有"66666"比萨饼正在运作...... 为什么???
这是我的jS代码:
$(document).ready(function(){
$.ajax({
type: "GET",
url: "example.xml",
dataType: ($.browser.msie) ? "text" : "xml",
success: function(xml) {
$(xml).find('row').each(function(){
var Col0 = $(this).find('nompizz').text();
var Col1 = $(this).find('petit').text();
var Col2 = $(this).find('moyen').text();
var Col3 = $(this).find('grand').text();
$('<tr id="bar"></tr>').html('<th class="title">'+Col0+'</th><td onclick="DisPlay('+Col1+');GetName('+Col0+');">'+Col1+'€</td><td onclick="DisPlay('+Col2+');GetName('+Col0+');">'+Col2+'€</td><td onclick="DisPlay('+Col3+');GetName('+Col0+');">'+Col3+'€</td>').appendTo('#pizzas');
});
}
});
});
function DisPlay(Figure) {
var Display = document.getElementById('Display');
if (Figure === null) {
Display.value = Figure;
}
else {
Display.value += "+"+Figure;
Screen = Display.value
result = eval(Screen);
Display.value =result; …Run Code Online (Sandbox Code Playgroud)