Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New to the CF scene
    Join Date
    Jul 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Object doesn't support this property or method - ActiveX

    Hi All,

    Need some urgent.

    We are having a javascript which is throwing the foll error

    "Object doesn't support this property or method".

    The javascript function being called is using a Scanner API. So this is using some ActiveX.


    Below is the code for javascript

    <script language="javascript">

    // Initialize scanning
    function OnLoad()
    {
    try
    {
    Scanner.OpenScanner();
    // Scanner.ScanPriority = 0; // Set scanner to Foreground Read mode before enable scanning
    // Scanner.EnableScanning(1);
    document.forms["mobileform"]["rm07m-bwartwe[1]"].value = "101";
    }
    catch (e)
    {
    alert(e.message);
    }
    }

    // Clean up
    function OnUnload()
    {
    Scanner.CloseScanner();
    // Calling Dispose is necessary for Pocket IE because of a Microsoft issue related to releasing object.
    if (navigator.appName == "Microsoft Pocket Internet Explorer")
    Scanner.Dispose();
    }

    // Scan through soft trigger
    function Scan()
    {
    try
    {
    Scanner.SetSoftTrigger(1);
    }
    catch (e)
    {
    alert(e.message);
    }
    }

    //User-defined function to format error codes.
    //VBScript has a Hex() function but JScript does not.
    function hex(nmb)
    {
    if (nmb > 0)
    return nmb.toString(16);
    else
    return (nmb + 0x100000000).toString(16);
    }

    </script>

    There is a object tag in html

    <object id="Scanner"></object>

    The javascript functions are called from body tag.

    Can someone please provide some help.

    Thanks,
    Nikhil

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    26,536
    Thanks
    80
    Thanked 4,490 Times in 4,454 Posts
    I assume you know that ActiveX will only work in MSIE browsers?

    But in any case, that <object> tag is incomplete. Did you only show a small part of it?

    And, finally, you don't bother to say WHICH LINE you are getting the error from.

  • #3
    New to the CF scene
    Join Date
    Jul 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi,

    The complete object tag is as follows

    <OBJECT id=Scanner style="LEFT: 0px; WIDTH: 0px; TOP: 0px; HEIGHT: 0px"
    classid=clsid:5FFAA94A-D9E2-405d-9644-EE2196713A3C>
    </OBJECT>

    I am getting the error in the following line

    Scanner.OpenScanner();


    Thanks,
    Nikhil

  • #4
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    26,536
    Thanks
    80
    Thanked 4,490 Times in 4,454 Posts
    Hmmm...can't tell.

    You really should have "..." around the classid. But it *probably* isn't needed.

    I assume that you have ensured that the Scanner object is indeed installed and registered on the computer where you are attempting this? Have you checked the registry?

  • #5
    Senior Coder alykins's Avatar
    Join Date
    Apr 2011
    Posts
    1,806
    Thanks
    41
    Thanked 199 Times in 198 Posts
    i think the issue is in how you ID'd it... try encasing the id in ""s so id="Scanner"... i am not too sure if this will fix it, but the way i am reading this error is not in relation to the tag <object>... i think that is just a coincidence... my insight comes from doing thins in C#... and yes i know this is javascript, but langs are similar.. a method or property is applied to an object... everything in your code is an object, the tags are objects, even the classes can be objects... i think what is happening is the "object" which is Scanner is not able to be found because it is not contained in "" 's... i could be wrong, but it is a simple "quick fix" that you could try

    I code C hash-tag .Net
    Reference: W3C W3CWiki .Net Lib
    Validate: html CSS
    Debug: Chrome FireFox IE

  • #6
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    26,536
    Thanks
    80
    Thanked 4,490 Times in 4,454 Posts
    If this weren't MSIE, I'd agree with you alykins.

    But MSIE *does* treat objects (of any kind...including <div> and <tr> and so on, not just <object>) as global variables when you refer to them by their ID.

    In other words, where other browsers would want you to do
    Code:
        var Scanner = document.getElementById("Scanner");
    MSIE makes that assignment, implicitly. (At least it did so up until MSIE 8....your mileage my vary in MSIE 9, which tries to be more standards compliant.)

    My *gut* feeling is that the ActiveX control is not installed on the machine that is trying to use this script. But that's just a feeling.

  • #7
    Senior Coder alykins's Avatar
    Join Date
    Apr 2011
    Posts
    1,806
    Thanks
    41
    Thanked 199 Times in 198 Posts
    question... don't you need to pull the document id of Scanner before you can reference it? or at least tell the script to look in the document to find it?

    I code C hash-tag .Net
    Reference: W3C W3CWiki .Net Lib
    Validate: html CSS
    Debug: Chrome FireFox IE


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •