English 中文(简体)
j Query “Microsoft J.R.R.R.P.R.R.P.R.M.R.M.K.R.M.K.R.M.K.R.M.K.R.M.P.R.M.K.R.M.M.K.R.M.K.M.R.M.K.M.R.M.R.M.M.K.R.M.M.R.M.M.R.M.M.K.R.: 预期目标”
原标题:jQuery "Microsoft JScript runtime error: Object expected"

我的以下法典似乎根本不可行: 我不断忘记:

Microsoft JScript runtime error: Object expected

出现这一错误似乎是在时间取消时发生的。 因此,如果我用10秒的时间提一下错误,就会再错10秒。

我希望能够更新在线朋友人数。 这一数字如下:

<a href="" id="showChat" >Friends online <strong id="friendsOnline">(?)</strong></a>

朋友部分在第一波段,但当时间外出时,不会再火。 而且,我看不到哪一条错误发生,因为如果我想要打破错误,它只是表明“没有源代码”。

下面的法典是使用Im的代码。 感谢!

<script src="http://ajax.microsoft.com/ajax/jquery/jquery-1.3.2.js" type="text/javascript"></script> 
<script src= /Scripts/MicrosoftAjax.js  type="text/javascript"></script> 
<script src= /Scripts/MicrosoftMvcAjax.js  type="text/javascript"></script> 
<script src= /Scripts/jquery.autocomplete.js  type="text/javascript"></script>

<script type="text/javascript"> 
$(document).ready(function() {
    UpdateFriendsOnline();
    function UpdateFriendsOnline() {
        window.setTimeout("UpdateFriendsOnline()", 1000);
        $.get("/Account/GetFriendsOnline", function(data) {
            $("#friendsOnline").html("(" + data + ")");

        });
    }
});
</script>
最佳回答

更改<代码>准时()

window.setTimeout(UpdateFriendsOnline, 1000);

目前,你的职能在<条码>文件>、读号之外,因此无法作为全球职能加以利用,而全球职能通过时正试图加以利用。 作为一项一般规则,如果你可以避免,永远不会有ever<>m> > settimeout(<>/code> ...... ......它会造成像本案这样的问题,我可以想一想一例(如果可以避免的话)会更好。

此外,我建议,当你回头答复时,如果你开始提出重叠的jax请求,你可以这样做,为此调整你的职能:

function UpdateFriendsOnline() {
  $.get("/Account/GetFriendsOnline", function(data) {
    $("#friendsOnline").html("(" + data + ")");
    window.setTimeout(UpdateFriendsOnline, 1000);
  });
}
问题回答

为此:

window.setTimeout(UpdateFriendsOnline, 1000);

如果该功能在全球名称空间中界定,你本会使用。

这样,你就在当地再次提到这项职能,而这项职能将每两年一次。


http://www.un.org。

如果你需要在新的一开始之前取消先前的要求,你可以这样做:

<script type="text/javascript"> 
$(document).ready(function() {
    var request;   // Stores XMLHTTPRequest object
    UpdateFriendsOnline();
    function UpdateFriendsOnline() {
        if(request) request.abort();  // Abort current request if there is one

        window.setTimeout(UpdateFriendsOnline, 1000);

           // Store new XMLHTTPRequest object
        request = $.get("/Account/GetFriendsOnline", function(data) {
            request = null;  // Clear request object upon success
            $("#friendsOnline").html("(" + data + ")");
        });
    }
});
</script>




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...