Jquery IE和Chrome(开发工具)都没有显示任何错误,然后呢?

Jquery IE和Chrome(开发工具)都没有显示任何错误,然后呢?,jquery,sharepoint-2010,slide,Jquery,Sharepoint 2010,Slide,$(“.slides\u容器”).append(liHtml)的语法是否正确?1号(浏览器客户端)正在抱怨 <link rel="stylesheet" href="_layouts/jquery/global.css"> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script> <scri

$(“.slides\u容器”).append(liHtml)的语法是否正确?1号(浏览器客户端)正在抱怨

<link rel="stylesheet" href="_layouts/jquery/global.css">
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
<script type="text/javascript" src="_layouts/jquery/slides.min.jquery.js"></script>


<script>
        $(function(){
            $('#slides').slides({
                preload: true,
                preloadImage: '_layouts/jquery/loading.gif',
                play: 5000,
                pause: 2500,
                hoverPause: true,
                animationStart: function(current){
                    $('.caption').animate({
                        bottom:-50
                    },100);
                    if (window.console && console.log) {
                        // example return of current slide number
                        console.log('animationStart on slide: ', current);
                    };
                },
                animationComplete: function(current){
                    $('.caption').animate({
                        bottom:0
                    },200);
                    if (window.console && console.log) {
                        // example return of current slide number
                        console.log('animationComplete on slide: ', current);
                    };
                },
                slidesLoaded: function() {
                    $('.caption').animate({
                        bottom:0
                    },200);
                }
            });
        });
</script>

<div id="container">    
    <div id="slides">
        <div class="slides_container"></div>
        <a href="#" class="prev"><img src="_layouts/jquery/arrow-prev.png" width="24" height="43" alt="Arrow Prev"></a>
        <a href="#" class="next"><img src="_layouts/jquery/arrow-next.png" width="24" height="43" alt="Arrow Next"></a>
    </div>
    <img src="_layouts/jquery/example-frame.png" width="739" height="341" alt="Example Frame" id="frame">
</div>      

<script>

  function GetAllImages()
    {
       $("#slideshowPicturePlaceholder").css("display", "block");
       var soapEnv = "<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'><soapenv:Body><GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'>";
       soapEnv += "<listName>Splash Image Rotator</listName>";
       soapEnv += "<query><Query><Where><Eq> <FieldRef Name='Active'/> <Value Type='Boolean'>1</Value> </Eq> </Where><OrderBy Override='TRUE'><FieldRef Name='Created' Ascending='FALSE' /></OrderBy></Query></query>";
       soapEnv += "<viewFields><ViewFields><FieldRef Name='Title'/><FieldRef Name='ows_FileLeafRef'/><FieldRef Name='NewsLink'/></ViewFields></viewFields><rowLimit></rowLimit>";      
       soapEnv += "</GetListItems></soapenv:Body></soapenv:Envelope>";

       var port = window.location.port;
       if (port.length <= 0)
       port = "";
       else
       port = ":" + port;
       var webservice = window.location.protocol + "//" + window.location.hostname + port + L_Menu_BaseUrl + "/_vti_bin/lists.asmx";

       $.ajax(
       {
          url : webservice,
          type : "POST",
          dataType : "xml",
          data : soapEnv,
          complete : processQueryResults,
          contentType : "text/xml; charset=utf-8",
          error : function (xhr)
          {
             alert('Error!  Status = ' + xhr.status);
          }
       });   
    }
    function processQueryResults(xData, status)
    {
       var port = window.location.port;
       if (port.length <= 0)
       port = "";
       else
       port = ":" + port;

       var imageURL = window.location.protocol + "//" + window.location.hostname + port + L_Menu_BaseUrl + "/Splash Image Rotator/";           
       $(xData.responseXML).find("z\\:row").each(function ()
       {
          var title = $(this).attr("ows_Title");          
          var imageLink = imageURL + $(this).attr("ows_FileLeafRef").substring($(this).attr("ows_FileLeafRef").indexOf('#') + 1);         
          var itemLink = $(this).attr("ows_NewsLink");
          var liHtml = "<div class='slide'><a href='"+itemLink+"' target='_blank' border='0'><img width='420' height='220'  src='" + imageLink +"'/></a>" + "<div class='caption' style=\"bottom:'0'\"><p>" + title + "</p></div></div>";

        $(".slides_container").append(liHtml);      
        });

    }             
GetAllImages();

</script>

$(函数(){
$(“#幻灯片”)。幻灯片({
预加载:正确,
预加载图像:''u layouts/jquery/loading.gif',
播放:5000,
暂停:2500,
悬停:是的,
animationStart:函数(当前){
$('.caption')。设置动画({
底部:-50
},100);
if(window.console&&console.log){
//返回当前幻灯片编号的示例
log('animationStart on slide:',当前);
};
},
动画完成:功能(当前){
$('.caption')。设置动画({
底部:0
},200);
if(window.console&&console.log){
//返回当前幻灯片编号的示例
log('animationComplete on slide:',当前);
};
},
slidesloadded:function(){
$('.caption')。设置动画({
底部:0
},200);
}
});
});
函数GetAllImages()
{
$(“#slideshowPicturePlaceholder”).css(“显示”、“块”);
var soapEnv=“”;
soapEnv+=“飞溅图像旋转器”;
soapEnv+=“1”;
soapEnv+=“”;
soapEnv+=“”;
var port=window.location.port;
如果(port.length我使用检查标记(稍微编辑)与HTML5 doctype的对比:

<!DOCTYPE html>
<html>
  <head>
     <title>asdf</title>
  </head>
  <body>
    <div class='slide'><a href='asdf' target='_blank' border='0'><img width='420' height='220'  src='asdf'/></a><div class='caption' style='bottom:0'><p>asdf</p></div></div>
  </body>
</html>

asdf
asdf

这会产生以下错误:

  • 锚点没有边框属性。是否要将其样式设置为
  • 图像应该有一个alt标记

是的,您在liHtml上的标记是无效的,但很容易修复。

Mike提出了几点建议。将所有这些代码缩减到您希望我们看到的代码-对于一个简单的jquery append语法问题来说,这太多了。另外,编辑您的标题,以便清楚地表明您确实有兴趣询问jquery.append().最后,您的客户端使用什么浏览器?