Connecting Tech Pros Worldwide Help | Site Map

Javascript: Object doesn't support this property or method

  #1  
Old July 14th, 2006, 01:34 AM
Newbie
 
Join Date: Jul 2006
Location: Philippines
Posts: 5
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:

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

inside mousedown,

[HTML]mousedown = true;[/HTML]

inside mousemove,

[HTML]if (mousedown)

{

....

}[/HTML]


Partial Codes:

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

var mousedown;

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

// if (window.event.button == 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="mouseOver(this)" onmousedown="mousedown()" onmousemove="mouseDragImage(this)" onmouseout="mouseup()"/><br /><br />
<input id="Button1" type="button" value="button" />

</body>
[/HTML]

den2005
  #2  
Old July 15th, 2006, 12:49 AM
iam_clint's Avatar
Forum Leader
 
Join Date: Jul 2006
Location: Oklahoma
Posts: 1,077

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;
}
  #3  
Old April 14th, 2007, 07:58 PM
Newbie
 
Join Date: Mar 2007
Posts: 25

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
Expand|Select|Wrap|Line Numbers
  1. something = http.responseText.split("||");
  2.  
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"
Expand|Select|Wrap|Line Numbers
  1. numrows = result.getElementByName("numrows").innerHTML;
  2. numfields = result.getElementByName("numfields").innerHTML;
  3. array1 = something.getElementById("array1").innerHTML;
  4.  
All my text fields have ID's. Does anyone have any insight into this?

RPJD
  #4  
Old April 16th, 2007, 10:53 AM
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,521
Provided Answers: 12

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
Expand|Select|Wrap|Line Numbers
  1. something = http.responseText.split("||");
  2.  
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"
Expand|Select|Wrap|Line Numbers
  1. numrows = result.getElementByName("numrows").innerHTML;
  2. numfields = result.getElementByName("numfields").innerHTML;
  3. array1 = something.getElementById("array1").innerHTML;
  4.  
All my text fields have ID's. Does anyone have any insight into this?

RPJD
Post your HTML code (your text fields).
Reply


Similar Threads
Thread Thread Starter Forum Replies Last Post
Object doesn't support this property or method pankajprakash answers 1 April 18th, 2008 10:25 AM
object does not support this property or method 2146827850 stellstarin@gmail.com answers 7 April 27th, 2006 11:25 AM
Javascript error headache: object doesn't support this property or method news.onetel.net.uk answers 3 July 23rd, 2005 01:56 PM
strange "Object doesn't support this property or method" problem Olaf answers 2 July 23rd, 2005 12:47 PM