我不打算你会调试它,但也许你可以在一瞬间看到: 我写了一个简单的页面,显示“正在运行的消息”。
但它仅适用于Chrome(不是FF或IE) http://hydepark.apphb.com/display.aspx 我认为这是一个服务器方面的问题,但它没有意义,因为它依赖于浏览器。
你有个主意吗?
var msgsList = [{"Guid":"c281e6ec-acdc-4c35-80ee-12c9ba1ab95e","Author":"2","Content":"222","Email":"22","CreationDate":"\/Date(1321389457043)\/","Rating":0,"Path":"D:\\websites\\b1\\08c47\\4f839e3\\_PublishedWebsites\\TB.Site\\c281e6ec-acdc-4c35-80ee-12c9ba1ab95e.html"},{"Guid":"58aaa80d-f09e-439a-bec6-60b090f39c26","Author":"1","Content":"111","Email":"11","CreationDate":"\/Date(1321389451653)\/","Rating":0,"Path":"D:\\websites\\b1\\08c47\\4f839e3\\_PublishedWebsites\\TB.Site\\58aaa80d-f09e-439a-bec6-60b090f39c26.html"}];
var pagePath = window.location.pathname;
//parses the list
$(document).ready(function ()
{
parseList = function(pos,list)
{
if (pos < list.length)
{
var obj = list[pos];
TextArea1.value = obj.Content;
Author.value = obj.Author;
var newHeading = encodeURIComponent( window.location.href +"?id="+ obj.Guid );
var likeFrame = $('.fb-like iframe');
//var likeFrame = $('iframe.fb_ltr')[0];
var newHref = 'href=' + newHeading + '&layout=';
var newSrc = likeFrame.attr('src').replace(/href=.+&layout=/, newHref);
likeFrame.attr('src', newSrc);
setTimeout(function(){parseList(++pos,list);}, 5000);
}
else
{
//PageMethod('RefillMessages', [], AjaxSucceeded, AjaxFailed);
WebMethod('RefillMessages', [], AjaxSucceeded, AjaxFailed);
}
}
setTimeout(function(){parseList(0,msgsList);}, 2000);
//parseList(0,msgsList);
});
答案 0 :(得分:0)
TextArea1.value = obj.Content;
你永远不应该只通过它的id来引用一个元素。有些浏览器会支持旧版&gt; 10年前的编码方式。
document.getElementById("TextArea1").value = obj.Content;
答案 1 :(得分:0)
如果您在Firefox上打开Firebug,您会看到TextArea1
未定义。
看起来Chrome正在考虑将其视为全局变量,而FF则不是。
阅读表单的一种简单方法是通过id获取它,并使用其名称读取字段,例如:
var frm = document.getElementById('form1');
//then get it by frm.TextArea1.value