Javascript 函数在Vista上不工作

Javascript 函数在Vista上不工作,javascript,epad,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 a

我有这个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');
    }
}

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'); 
    } 
} 

“不工作”是什么意思?它是否抛出错误或结果不符合预期?您使用的是哪种解释器?Windows脚本主机?什么是ePad?装置?产品?月台?你能给出一个链接吗?@pekka:@Gumbo:It抛出Javascript对象预期错误@jball:Windows脚本主机好吧,可能是ePad未连接或/或驱动程序未安装?:)你确定他们是吗?您的用户权限是否允许您访问该设备?您可以尝试以管理员身份运行脚本吗?据我所知,Vista有时真的是一款PITA rights wise。如何、何时、何地加载ePad
window.document.esCapture1默认情况下在WSH中几乎不可用,是吗?您的问题是否被下面jball的答案所回答(是语法问题),还是您的设备无法工作?