Javascript: Object doesn't support this property or method

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • den2005
    New Member
    • Jul 2006
    • 5

    Javascript: Object doesn't support this property or method

    Hi everybody,

    Problem with dragging effect of resizing is working but having problem with setting a flag to determine if mouse button is click or not. Is there anyone knows how to fixed this? I used several ways to do this as shown below, all telling me the error below. I used IE 6 w/ SP1.
    The error comes from onmousedown"mou sedown()".


    Error message:

    Microsoft JScript runtime error: Object doesn't support this property or method


    Approaches made:

    [HTML]var mousedown = false;[/HTML]

    inside mousedown,

    [HTML]mousedown = true;[/HTML]

    inside mousemove,

    [HTML]if (mousedown)

    {

    ....

    }[/HTML]


    Partial Codes:

    [HTML]
    <head>
    <title>Untitl ed Page</title>
    <script type="text/javascript" language="javas cript">
    var lLeft = 0;
    var lTop = 0;

    var mousedown;

    function mouseDragImage( obj)
    {
    ....
    var dLeft, dTop;
    var ev = window.event;

    // if (window.event.b utton == 1)
    // if (ev.button == 1)
    // if (mousedown)
    // if (mousedown == 'true')
    if (mousedown == 1)
    {
    if(ev.pageX || ev.pageY){
    newx = ev.pageX;
    newy = ev.pageY;
    }
    else
    {
    newx = ev.clientX;
    newy = ev.clientY;
    }

    .....
    }
    }

    function mousedown()
    {

    // mousedown = 'true';
    // mousedown = true;
    if (mousedown != null || mousedown > 0)
    {
    mousedown = 1;
    }
    }

    function mouseup()
    {
    // mousedown = 'false';
    // mousedown = false;
    mousedown = 0;
    }


    .....
    </script>
    </head>

    <body>
    <input id="Text1" type="text" /><br />
    <img id="Img3" name="Img3" src="images/rock.jpg" onmouseover="mo useOver(this)" onmousedown="mo usedown()" onmousemove="mo useDragImage(th is)" onmouseout="mou seup()"/><br /><br />
    <input id="Button1" type="button" value="button" />

    </body>
    [/HTML]

    den2005
  • iam_clint
    Recognized Expert Top Contributor
    • Jul 2006
    • 1207

    #2
    you might try a on mouse down and on mouse up such as
    onmousedown="mo usepress(0);" onmouseup="mous epress(1);"
    var mousestate
    function mousepress(stat e) {
    mousestate = state;
    }

    Comment

    • rpjd
      New Member
      • Mar 2007
      • 25

      #3
      Originally posted by iam_clint
      you might try a on mouse down and on mouse up such as
      onmousedown="mo usepress(0);" onmouseup="mous epress(1);"
      var mousestate
      function mousepress(stat e) {
      mousestate = state;
      }
      Hi, I'm having this problem with getElementBy*** *****
      I have an xmlhttprequest call which works as far as
      Code:
      something = http.responseText.split("||");
      the request is calling a php script which queries a database giving me two variables $numfields and $numrows, and two arrays, array1[] and array2[][], self-explantory. When I try to assign the two variables using getElementByNam e, or when I try to assign either array using getElementById I get the same error "Object doesn't support this property or method"
      Code:
      numrows = result.getElementByName("numrows").innerHTML;
      numfields = result.getElementByName("numfields").innerHTML;
      array1 = something.getElementById("array1").innerHTML;
      All my text fields have ID's. Does anyone have any insight into this?

      RPJD

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        Originally posted by rpjd
        Hi, I'm having this problem with getElementBy*** *****
        I have an xmlhttprequest call which works as far as
        Code:
        something = http.responseText.split("||");
        the request is calling a php script which queries a database giving me two variables $numfields and $numrows, and two arrays, array1[] and array2[][], self-explantory. When I try to assign the two variables using getElementByNam e, or when I try to assign either array using getElementById I get the same error "Object doesn't support this property or method"
        Code:
        numrows = result.getElementByName("numrows").innerHTML;
        numfields = result.getElementByName("numfields").innerHTML;
        array1 = something.getElementById("array1").innerHTML;
        All my text fields have ID's. Does anyone have any insight into this?

        RPJD
        Post your HTML code (your text fields).

        Comment

        • The Minster

          #5
          when using getbyName your text field must have name
          and when using getbyId ur text filed must have an id

          Sometimes only one of them working somtime both depends on the browser mode

          Comment

          • super guy

            #6
            just use single quotes instead of double quotes,

            Wrong
            something.getEl ementById("arra y1").innerHTM L;
            Right
            something.getEl ementById('arra y1').innerHTML;

            Comment

            Working...