小编Beu*_*rld的帖子

如何获取HTML5的window.fileReader API的Cross Browser兼容性

嗨Html5开发人员和HTML4开发人员......

我想知道是否有任何方法支持IE8及以上版本的html5的window.fileReader API.

代码如下:

if(window.fileReader){
  alert("supported"); // in html5 works and fires alert but not in IE8 
}
Run Code Online (Sandbox Code Playgroud)

实际上,我想在提交之前阅读文件的内容.

  • 我是否可以使用某些条件,如果支持window.fileReader,则
    使用HTML5跟随'A'代码行,否则如果不支持window.fileReader则
    使用其他东西...来读取文件
  • 我也想知道在不使用
    HTML5 fileAPI但不使用ActiveXObject的情况下读取文件内容的方法.

等待回复..

javascript html5

3
推荐指数
1
解决办法
1万
查看次数

函数完成后如何等待(2秒)?

我有执行的 javascript 函数,执行后我想等待 2 秒。在 Javascript 中是否可能。

我的问题不同。我想在函数执行或完成执行后等待,而不是等到函数执行为止。

JavaScript 函数

function ajax_closeCall(onDone) {
    // alert("Close Call invoked.");
    closeCall_onDone = onDone;
    var closeCallUrl = soapUrl + "?action=closeCall&parentSessionId=" + parentSessionId;
    closeCall_http_request = getNewHttpRequest('text/plain');
    closeCall_http_request.onreadystatechange = callback_ajax_closeCall;
    // http_request.open("POST", soapUrl, true);
    closeCall_http_request.open("GET", closeCallUrl, true);
    closeCall_http_request.send(null);
}


function callback_ajax_closeCall() {
    if (closeCall_http_request.readyState != 4) {
        return;
    }

    if (closeCall_http_request.status == 200) {
        if (closeCall_onDone) {
            closeCall_onDone();
        }
        stopMonitorCallState();
        ajax_getCallState();
    } else {
        // there was a problem with the request,
        // for example the …
Run Code Online (Sandbox Code Playgroud)

javascript ajax

1
推荐指数
1
解决办法
7471
查看次数

标签 统计

javascript ×2

ajax ×1

html5 ×1