Login or Sign up Help | Site Map
Connecting Tech Pros Worldwide

Javascript: Object doesn't support this property or method

Question posted by: den2005 (Newbie) on July 14th, 2006 12:34 AM
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"mousedown()".


Error message:

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


Approaches made:

Code: ( text )
  1. var mousedown = false;


inside mousedown,

Code: ( text )
  1. mousedown = true;


inside mousemove,

Code: ( text )
  1. if (mousedown)
  2.  
  3. {
  4.  
  5. ....
  6.  
  7. }



Partial Codes:

Code: ( text )
  1. <head>
  2.     <title>Untitled Page</title>
  3.     <script type="text/javascript" language="javascript">
  4.         var lLeft = 0;
  5.         var lTop = 0;
  6.        
  7.         var mousedown;
  8.  
  9.       function mouseDragImage(obj)
  10.       {
  11.           ....
  12.             var dLeft, dTop;
  13.             var ev = window.event;
  14.            
  15. //           if (window.event.button == 1)
  16. //            if (ev.button == 1)
  17. //          if (mousedown)
  18. //          if (mousedown == 'true')
  19.             if (mousedown == 1)
  20.             {
  21.                 if(ev.pageX || ev.pageY){
  22.                     newx = ev.pageX;
  23.                     newy = ev.pageY;
  24.                 }
  25.                 else
  26.                 {
  27.                     newx = ev.clientX;
  28.                     newy = ev.clientY;
  29.                 }         
  30.                
  31.                 .....
  32.             }
  33.          }     
  34.  
  35.        function mousedown()
  36.        {            
  37.  
  38. //          mousedown = 'true';
  39. //          mousedown = true;
  40.             if (mousedown != null || mousedown > 0)
  41.             {
  42.                 mousedown = 1;
  43.             }
  44.         }
  45.        
  46.         function mouseup()
  47.         {
  48. //            mousedown = 'false';
  49. //            mousedown = false;   
  50.             mousedown = 0;
  51.         }   
  52.  
  53.  
  54.      .....
  55.   </script>
  56.   </head>
  57.  
  58.  <body>
  59.     <input id="Text1" type="text" /><br />
  60.     <img id="Img3" name="Img3" src="images/rock.jpg" onmouseover="mouseOver(this)" onmousedown="mousedown()" onmousemove="mouseDragImage(this)" onmouseout="mouseup()"/><br /><br />
  61.     <input id="Button1" type="button" value="button" />
  62.  
  63. </body>


den2005
Would you like to answer this question?
Sign up for a free account, or Login (if you're already a member).
iam_clint's Avatar
iam_clint
Forum Leader
960 Posts
July 14th, 2006
11:49 PM
#2

Re: Javascript: Object doesn't support this property or method
you might try a on mouse down and on mouse up such as
onmousedown="mousepress(0);" onmouseup="mousepress(1);"
var mousestate
function mousepress(state) {
mousestate = state;
}

Reply
rpjd's Avatar
rpjd
Newbie
25 Posts
April 14th, 2007
06:58 PM
#3

Re: Javascript: Object doesn't support this property or method
Quote:
Originally Posted by iam_clint
you might try a on mouse down and on mouse up such as
onmousedown="mousepress(0);" onmouseup="mousepress(1);"
var mousestate
function mousepress(state) {
mousestate = state;
}

Hi, I'm having this problem with getElementBy********
I have an xmlhttprequest call which works as far as
Code: ( text )
  1. 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 getElementByName, or when I try to assign either array using getElementById I get the same error "Object doesn't support this property or method"
Code: ( text )
  1. numrows = result.getElementByName("numrows").innerHTML;
  2. numfields = result.getElementByName("numfields").innerHTML;
  3. array1 = something.getElementById("array1").innerHTML;


All my text fields have ID's. Does anyone have any insight into this?

RPJD

Reply
acoder's Avatar
acoder
Site Moderator
10,653 Posts
April 16th, 2007
09:53 AM
#4

Re: Javascript: Object doesn't support this property or method
Quote:
Originally Posted by rpjd
Hi, I'm having this problem with getElementBy********
I have an xmlhttprequest call which works as far as
Code: ( text )
  1. 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 getElementByName, or when I try to assign either array using getElementById I get the same error "Object doesn't support this property or method"
Code: ( text )
  1. numrows = result.getElementByName("numrows").innerHTML;
  2. numfields = result.getElementByName("numfields").innerHTML;
  3. 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).

Reply
Reply
Not the answer you were looking for? Post your question . . .
180,433 Experts ready to help you find a solution.
Sign up for a free account, or Login (if you're already a member).

Top Javascript / DHTML / Ajax Forum Contributors