-2

我无法解决以下代码中出现的未知错误,页面变为空白。阀门即将进入 obj。请帮忙。

function ServiceSucceeded(result) {
    if (DataType == "json") {
        //alert(result);
        var obj = $.parseJSON(result);
        if (obj != null) {

            $("#CoverFlow").html("<div id=contentFlow class=ContentFlow> " +
                "<div class=loadIndicator><div class=indicator></div></div> " +
                "<div class=flow>"
            $.each(obj, function (key, value) {

                "  <div class=item href=#>   " +
                    "  <img id=" + value.ManufID + " class=content src=" + value.ManufUrl + " name=" + value.ManufName + " />" +
                    "  <div class=caption>" + value.ManufName + "  </div>" +
                    "  </div>"

            });
            "  </div>" +
                "  <div class=\"globalCaption\"></div>" +
                "  <div class=\"scrollbar\">" +
                "  <div class=\"slider\"><div class=\"position\"></div></div>" +
                "  </div>"

            "  </div> ");
        }
    }
}
4

2 回答 2

2

虽然我没有尝试运行您的代码,但问题(我认为)似乎在代码的组织中。

var coverFlowHTML="<div id=contentFlow class=ContentFlow> " +
                "<div class=loadIndicator><div class=indicator></div></div> " +
                "<div class=flow>";


            $.each(obj, function (key, value) {

                coverFlowHTML+="  <div class=item href=#>   " +
                    "  <img id=" + value.ManufID + " class=content src=" + value.ManufUrl + " name=" + value.ManufName + " />" +
                    "  <div class=caption>" + value.ManufName + "  </div>" +
                    "  </div>";

            });

            coverFlowHTML+="  </div>" +
                "  <div class=\"globalCaption\"></div>" +
                "  <div class=\"scrollbar\">" +
                "  <div class=\"slider\"><div class=\"position\"></div></div>" +
                "  </div>"

            "  </div> ");


$("#CoverFlow").html(coverFlowHTML);

我知道这段代码可以(并且非常需要)进行优化,但这应该会产生一些结果。

于 2013-06-14T10:30:33.833 回答
0

代码真的不是很清楚,但是是否缺少连接+运算符?

        $("#CoverFlow").html("<div id=contentFlow class=ContentFlow> " +
            "<div class=loadIndicator><div class=indicator></div></div> " +
            "<div class=flow>" // <-- Missing operator??
        $.each(obj, function (key, value) {

您看到的确切错误是什么?

于 2013-06-14T10:25:58.313 回答