2

I have the following code:

document.getElementById("launcherDiv").innerHTML = 
"<object id='launcher' 
classid='CLSID:17E88883-3488-46B8-BE4D-30568888855' 
codebase='Helper.CAB#version=8,8,8,88'>
</object>";

Let say the download/installing failed,
How can I know this? depending of it that I can't know how much time it supposed to take..

If I will check in a loop how can I know when to end?

previously I used to define the tag inside the HTML and it waiting until the installation finished or failed.
But now I need delay loading of this ActiveX so I can't use this

Can anyone help me?


How do I get the mouse position in FireFox?

This code works in Google Chrome and IE but not in FireFox.

function drawChildren(names) {
    var c = document.getElementById("myCanvas");
    var ctx = c.getContext("2d");       
    var ctxcolor = "#000000";

    if(listeners < 1){
        c.addEventListener("click", getPosition, false);
        listeners = 1;
    } // At the click function "getPosition" is executed
}

function getPosition(event) {

    if ( event.offsetX == null ) { // Firefox
        clickedX = event.layerX;
        clickedY = event.layerY;
    } else {                       // Other browsers
        clickedX = event.offsetX;
        clickedY = event.offsetY;
    }

    checkCoordinates(clickedX, clickedY);  
}
4

4 に答える 4

4

object タグの読み込みに失敗すると、タグ間の内部 HTML がレンダリングされます。例えば

<object data="my/file/path.pdf">Object not supported</object>

オブジェクトが失敗した場合、内部テキスト、つまり「オブジェクトはサポートされていません」が表示されます

于 2014-12-05T07:36:21.613 に答える
0

たぶんこれが役立ちます:

    var iv = setInterval(function () {
    if (document.all["launcher"].readyState == 4) {
    clearInterval(iv)
    alert("Object loaded")
    }
    }, 100);

それが行うことは、100 秒ごとに readystate をチェックする間隔を設定し、オブジェクトがロードされた場合にアラートを出すことです。

于 2012-06-28T11:24:11.873 に答える