English 中文(简体)
定义
原标题:Javascript Undefined function
  • 时间:2010-01-06 20:57:20
  •  标签:
  • javascript

我在协会因特网应用中使用电子签名帕。 如果电梯没有连接,我就希望发出警报。

function isePad() {
            var epad;
            epad = window.document.esCapture1.ConnectedDevice;
            alert(epad);
            if (epad ==    ) {
                alert( Sorry epad is not Connected or drivers not installed );
            }


        }

在大多数机器中,它从事的是罚款。 在某些机器中,第一次警报显示未确定的价值。 我愿表示警惕(见附件)。 职业电子垫子没有连接或没有安装的司机;

最佳回答

有了这一方法,<代码>epad>将评价到false。 具有<条码>价值的<条码>

if (!epad) {
    alert( Sorry epad is not Connected or drivers not installed );
}
问题回答
function isePad() {
            var epad;
            epad = window.document.esCapture1.ConnectedDevice;
            alert(epad);
            if (epad ==    or epad == undefined) {
                alert( Sorry epad is not Connected or drivers not installed );
            }


}

提 出

if (epad ==    || typeof epad ==  undefined ) {

而不是

if (epad ==    ) {

因此,其中一些对我来说是新的,也许其他人会有宝贵的东西来补充我所说的话......。

或许可以尝试这样的东西......

(function() {
    var epad = window.document.esCapture1 && window.document.esCapture1.ConnectedDevice;
    alert(epad);
    !epad && alert( Sorry epad is not Connected or drivers not installed );
})();

举例来说,我认为,如果窗口文件,一些或所有浏览器可能会在功能的1线上cho。 Capture1本身没有界定,因此我已经改变,以防这种可能性。

此外,将这一检验列入匿名功能,使全球名称空间变形,而全球名称空间是一个好的想法(除非你在其他地方需要)。

最后一行只是检验,看单板变量是falsy,即如果电梯无效、不明确或虚假,那么第2次警报就会出现。





相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签