功能无法在Vista上运行

时间:2010-01-20 17:53:31

标签: javascript epad

我有这个JavaScript函数,它在我尝试的所有机器上工作,除了在Vista上运行的机器。我正在调用此函数onload。你认为这个错误是什么。

function isePad() {
    var epad;
    epad = window.document.esCapture1.ConnectedDevice;

    if (!epad) {
        alert('Sorry epad either is not Connected or/and drivers are not installed');
    }
}

1 个答案:

答案 0 :(得分:1)

esCapture1可能不存在 - 您应该首先检查它:

function isePad() { 
    var epad; 
    if(window.document.esCapture1){
        epad = window.document.esCapture1.ConnectedDevice; 
    }

    if (!epad) { 
        alert('Sorry epad either is not Connected or/and drivers are not installed'); 
    } 
}