首页 新闻 搜索 专区 学院

jquery 在 ie6 下 报错,提示缺少}

0
悬赏园豆:10 [已解决问题] 解决于 2010-09-07 14:12

下边的方法是读取数据列表功能

var PageNo=1,PageCount=1,pagesize=10,orderby,yhpl;   

 function load_yhpl()    {       

 orderby = document.getElementById("sltOrderBy").value; 

       var url="http://192.168.60.64/wowshop2/AjaxServers/Votes.aspx";  

      var data ="jsonpcallback=getVotesListJsonp&act=getVotesList&page="+PageNo+"&pagesize="+pagesize+"&orderby="+orderby+"&time="+Math.random();                $.ajax(        {            

type: "get",            

dataType: "jsonp",           

 jsonp:"jsonpcallback",            

url: url,            

data: data,               

 success: function(msg) {                        }        

});   

 }       

 function getVotesListJsonp(msg)    {        

var tmpHtml="<ul>";        

var votes = msg.Votes;        

$.each(votes, function(i, n)        

{            

PageCount = n.RowCount;            

tmpHtml+="<li class=" + n.CssName + ">";            

tmpHtml+="<table width=890 border=0 cellpadding=0 cellspacing=0>";            tmpHtml+="<tr>";            

tmpHtml+="<td width=125 valign=middle>第<span class="number">" + n.RowId + "</span>楼</td>";           

 tmpHtml+="<td width=125 valign=middle><span class="user_id">用户ID:" + n.UserId + "</span></td>";            

tmpHtml+="<td width=340 valign=middle class="slogan">广告语:<span class="red">" + n.VotesTitle+ "</span></td>";            

tmpHtml+="<td width=100 align=left valign=middle>总票数:<span class="red">" + n.TotalVotes + "</span></td>";           

 tmpHtml+="<td width=100 align=left valign=middle>周票数:<span class="red">" + n.weekVotes + "</span></td>";           

 tmpHtml+='<td width=100 align=center valign=middle><input type=button value=投票 class="toupiao_btn" onclick="return setVotes(' + n.VotesId + ');" /></td>';            tmpHtml+="<td id='td_"+n.VostesId+"' width=100 align=center valign=middle><input type='button' title=\"点击复制地址到剪贴板,直接在MSN/QQ上粘贴即可.\"  value='邀请好友投票' style='width:90px;' class='toupiao_btn' id=\"btn_InviteFriends_" + n.VotesId + "\" onclick=\"return InviteFriends('" + n.VotesId + "');\" /></td>";            tmpHtml+="</table>";            

tmpHtml+="</li>";            

tmpHtml+="<li class='ad_con' id='li_VotesContent_" + n.VotesId + "'>广告语创意说明:<span class="huise" style=color:#909090;>" + n.VotesContent + "</span></li>";        });        

tmpHtml+="</ul>";        $("#divVotesList").html(tmpHtml);     

 } 

下面的是查询后的jsonp数据:

jsonp1283833223096,getVotesListJsonp({"Votes":[{"RowCount":"1","CssName":"hui_tiao","RowId":"1","VotesId":"41","UserId":"15432","VotesTitle":"又来测试啦","TotalVotes":"13","weekVotes":"2","VotesContent":"又来测试啦又来测试啦"},{"RowCount":"1","CssName":"hui_tiao","RowId":"2","VotesId":"33","UserId":"15427","VotesTitle":"测试6","TotalVotes":"1","weekVotes":"1","VotesContent":"测试1测试1测试1测试1测试1"},{"RowCount":"1","CssName":"hui_tiao","RowId":"3","VotesId":"32","UserId":"15428","VotesTitle":"测试5","TotalVotes":"3","weekVotes":"2","VotesContent":"测试1测试1测试1测试1测试1"}]})

jquery 在 ie6 下 报错,提示缺少},但在ie7/8 FF 下都不会出错.

请各位大虾帮忙.急!在线=

问题补充: jquery 是兼容目前的主流浏览器.应该不是jquery的问题. 应该是我写的js代码有问题,但我检查了好几遍都没有发现有什么错误... 这是我改过后的代码: var PageNo=1,PageCount=1,pagesize=10,orderby,yhpl; function load_yhpl(){ orderby = document.getElementById("sltOrderBy").value; var url="http://www.wow-diamond.com.cn/AjaxServers/Votes.aspx"; var data ="jsonpcallback=getVotesListJsonp&act=getVotesList&page="+PageNo+"&pagesize="+pagesize+"&orderby="+orderby+"&time="+Math.random(); $.ajax({ type: "get", dataType: "jsonp", jsonp:"jsonpcallback", url: url, data: data, success: function(msg) {} }); } function getVotesListJsonp(msg){ var tmpHtml="<ul>"; var votes = msg.Votes; $.each(votes, function(i, n){ PageCount = n.RowCount; tmpHtml+="<li class='" + n.CssName + "'>"; tmpHtml+="<table width='890' border='0' cellpadding='0' cellspacing='0'>"; tmpHtml+="<tr>"; tmpHtml+="<td width='125' valign='middle'>第<span class='number'>" + n.RowId + "</span>楼</td>"; tmpHtml+="<td width='125' valign='middle'><span class='user_id'>用户ID:" + n.UserId + "</span></td>"; tmpHtml+="<td width='340' valign='middle' class='slogan'>广告语:<span class='red'>" + n.VotesTitle+ "</span></td>"; tmpHtml+="<td width='100' align='left' valign='middle'>总票数:<span class='red'>" + n.TotalVotes + "</span></td>"; tmpHtml+="<td width='100' align='left' valign='middle'>周票数:<span class='red'>" + n.weekVotes + "</span><
bicabo的主页 bicabo | 初学一级 | 园豆:160
提问于:2010-09-07 13:16
< >
分享
最佳答案
0

你写的脚本有点问题, 给你改了下:

  var PageNo = 1, PageCount = 1, pagesize = 10, orderby, yhpl;

        function load_yhpl() {

            orderby = document.getElementById("sltOrderBy").value;

            var url = "http://192.168.60.64/wowshop2/AjaxServers/Votes.aspx";

            var data = "jsonpcallback=getVotesListJsonp&act=getVotesList&page=" + PageNo + "&pagesize=" + pagesize + "&orderby=" + orderby + "&time=" + Math.random(); $.ajax({

                type: "get",

                dataType: "jsonp",

                jsonp: "jsonpcallback",

                url: url,

                data: data,

                success: function(msg) { }

            });
        }
        function getVotesListJsonp(msg) {

            var tmpHtml = "<ul>";

            var votes = msg.Votes;

            $.each(votes, function(i, n) {

                PageCount = n.RowCount;
                tmpHtml += "<li class=" + n.CssName + ">";
                tmpHtml += "<table width=890 border=0 cellpadding=0 cellspacing=0>";
                tmpHtml += "<tr>";
                tmpHtml += "<td width=125 valign=middle>第<span class=\"number\">" + n.RowId + "</span>楼</td>";
                tmpHtml += "<td width=125 valign=middle><span class=\"user_id\">用户ID:" + n.UserId + "</span></td>";
                tmpHtml += "<td width=340 valign=middle class=\"slogan\">广告语:<span class=\"red\">" + n.VotesTitle + "</span></td>";
                tmpHtml += "<td width=100 align=left valign=middle>总票数:<span class=\"red\">" + n.TotalVotes + "</span></td>";
                tmpHtml += "<td width=100 align=left valign=middle>周票数:<span class=\"red\">" + n.weekVotes + "</span></td>";
                tmpHtml += '<td width=100 align=center valign=middle><input type=button value=投票 class="toupiao_btn" onclick="return setVotes(' + n.VotesId + ');" /></td>';
                tmpHtml += "<td id='td_" + n.VostesId + "' width=100 align=center valign=middle><input type='button' title=\"点击复制地址到剪贴板,直接在MSN/QQ上粘贴即可.\"  value='邀请好友投票' style='width:90px;' class='toupiao_btn' id=\"btn_InviteFriends_" + n.VotesId + "\" onclick=\"return InviteFriends('" + n.VotesId + "');\" /></td>";
                tmpHtml += "</table>";
                tmpHtml += "</li>";
                tmpHtml += "<li class='ad_con' id='li_VotesContent_" + n.VotesId + "'>广告语创意说明:<span class=\"huise\" style=color:#909090;>" + n.VotesContent + "</span></li>";
            });

            tmpHtml += "</ul>";
            $("#divVotesList").html(tmpHtml);
        }

收获园豆:5
HUHU慈悲 | 大侠五级 |园豆:9973 | 2010-09-07 13:31
在哪个地方有问题,请指出细处.谢谢!
bicabo | 园豆:160 (初学一级) | 2010-09-07 13:41
class 赋值的时候,要么用单引号,要么用 反斜杠+双引号,不要直接用双引号。
HUHU慈悲 | 园豆:9973 (大侠五级) | 2010-09-07 13:45
确实是的. 谢谢! 但我改过后,脚本报错问题还是存在哦.
bicabo | 园豆:160 (初学一级) | 2010-09-07 13:56
虽然给出的意见没能解决问题,但还是谢谢大虾!
bicabo | 园豆:160 (初学一级) | 2010-09-07 14:12
其他回答(1)
0

可能是编码问题,IE6解析是乱码。

收获园豆:5
切忌浮躁 | 园豆:235 (菜鸟二级) | 2010-09-07 13:58
一语惊醒啊. 谢谢... 想了一上午没解决.
支持(0) 反对(0) bicabo | 园豆:160 (初学一级) | 2010-09-07 14:12
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册