oops I mean
if (tempX == 100)
{
//alert(document.getElemen
alert(e.knowdeID); // Seems to have forgotten which object I am on!
}
Main Topics
Browse All TopicsIs there a problem with doing:
document.onmousemove = this.getMouseXY;
Before a do the line above it knows exactly what object "this" refers to. I then calls the function fine (I've declared them as methods of the function). But then within the method getMouseXY the alert doesn't remember what object I was on, i.e. displays [Object] instead of [object Object]. Any ideas?
I guess I could store the object ID in a variable before calling the function, and then pick it up again from within the getMouseXY - it's just that solution is a bit untidy, and it would be easier to follow if I could just use the "this".
function startCheckMousePos()
{
// Start detecting where the mouse is.
// Detect if the browser is IE or not.
// If it is not IE, we assume that the browser is NS.
var IE = document.all?true:false;
// If NS -- that is, !IE -- then set up for mouse capture
if (!IE) document.captureEvents(Eve
// Set-up to use getMouseXY function onMouseMove
document.onmousemove = this.getMouseXY;
}
function stopCheckMousePos()
{
// Stop detecting where the mouse is.
// Detect if the browser is IE or not.
// If it is not IE, we assume that the browser is NS.
var IE = document.all?true:false;
// If NS -- that is, !IE -- then set up for mouse capture
if (!IE) document.releaseEvents(Eve
document.onmousemove = null;
}
function getMouseXY(e)
{
// Main function to retrieve mouse x-y position of the mouse.
// Temporary variables to hold mouse x-y positions.
var tempX = 0;
var tempY = 0;
// Detect if the browser is IE or not.
// If it is not IE, we assume that the browser is NS.
var IE = document.all?true:false
if (IE)
{
// grab the x-y pos.s if browser is IE
tempX = event.clientX + document.body.scrollLeft;
tempY = event.clientY + document.body.scrollTop;
}
else
{
// grab the x-y pos.s if browser is NS
tempX = e.pageX;
tempY = e.pageY;
}
// catch possible negative values in NS4
if (tempX < 0) {tempX = 0}
if (tempY < 0) {tempY = 0}
// show the position values in the form named Show
// in the text fields named MouseX and MouseY
document.Show.MouseX.value
document.Show.MouseY.value
if (tempX == 100)
{
//alert(document.getElemen
alert(this.knowdeID); // Seems to have forgotten which object I am on!
}
return true;
}
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
NB The knowde Object is something I created in Javascript that corresponds some boxes on the screen, i.e. the box is represented in JavaScript using an object, and it's corresponding properties are stored as property's of the object. I also have methods for resizing that particular box (using stylesheets too). - Just to give you a bit of background of what is going on ...
okay, you are right, and I think I understand what you wanted...sorta...
check this out:
it uses an object calle mobj, which gets set to whatever that last textbox mousedover was...
it also increments each class of the object seperately...
so if you mouse over box 2 three times and them put the cursor x pos at 100, then it will alert two or three I think...
if you then mouseover box 1, it will alert 0 because it is the first time that object had been moused over...
<HTML><HEAD>
<SCRIPT LANUAGE="JavaScript">
var c1=0
var c2=0
var mobj= new Object()
function startCheckMousePos()
{
// Start detecting where the mouse is.
// Detect if the browser is IE or not.
// If it is not IE, we assume that the browser is NS.
var IE = document.all?true:false;
// If NS -- that is, !IE -- then set up for mouse capture
if (!IE) document.captureEvents(Eve
// Set-up to use getMouseXY function onMouseMove
document.onmousemove = this.getMouseXY;
}
function stopCheckMousePos()
{
// Stop detecting where the mouse is.
// Detect if the browser is IE or not.
// If it is not IE, we assume that the browser is NS.
var IE = document.all?true:false;
// If NS -- that is, !IE -- then set up for mouse capture
if (!IE) document.releaseEvents(Eve
document.onmousemove = null;
}
function getMouseXY(e)
{
// Main function to retrieve mouse x-y position of the mouse.
// Temporary variables to hold mouse x-y positions.
var tempX = 0;
var tempY = 0;
// Detect if the browser is IE or not.
// If it is not IE, we assume that the browser is NS.
var IE = document.all?true:false
if (IE)
{
// grab the x-y pos.s if browser is IE
tempX = event.clientX + document.body.scrollLeft;
tempY = event.clientY + document.body.scrollTop;
}
else
{
// grab the x-y pos.s if browser is NS
tempX = e.pageX;
tempY = e.pageY;
}
// catch possible negative values in NS4
if (tempX < 0) {tempX = 0}
if (tempY < 0) {tempY = 0}
// show the position values in the form named Show
// in the text fields named MouseX and MouseY
document.Show.MouseX.value
document.Show.MouseY.value
if (tempX == 100)
{
//alert(document.getElemen
alert(mobj.knowdeID); // Seems to have forgotten which object I am on!
}
return true;
}
</SCRIPT>
</HEAD>
<BODY>
<FORM NAME="Show"><INPUT ONMOUSEOVER="this.knowdeID
</BODY>
</HTML>
anyways...
hope this helps,
Bob
It's time to clean up this topic area and that means taking care of this question. Your options at this point are:
1. Award points to the Expert who provided an answer, or who helped you most. Do this by clicking on the "Accept Comment as Answer" button that lies above and to the right of the appropriate expert's name.
2. PAQ the question because the information might be useful to others, but was not useful to you. To use this option, you must state why the question is no longer useful to you, and the experts need to let me know if they feel that you're being unfair.
3. Ask Community Support to help split points between participating experts. Just comment here with details.
4. Delete the question because it is of no value to you or to anyone else. To use this option, you must state why the question is no longer useful to you, and the experts need to let me know if they feel that you're being unfair.
If you elect for option 2, 3 or 4, just post comment with details here and I'll take it from there. We also request that you review any other open questions you might have and update/close them. Display all your question history from your Member Profile to view details.
PLEASE DO NOT AWARD THE POINTS TO ME.
__________________________
Hi Experts:
In the event that the Asker does not respond, I would very much appreciate your opinions as to which Expert ought to receive points (if any) as a result of this question. Likewise, you can also suggest that I PAQ or delete the question.
Experts, please do not add further "answer" information to this question. I will be back in about one week to finalize this question.
Thank you everyone.
Moondancer :)
Community Support Moderator @ Experts Exchange
P.S. Engineering has been advised about the error in the comment date/time sort order.
This question has been abandoned. I will make a recommendation to the
moderators on its resolution in a week or two. I appreciate any comments
that would help me to make a recommendation.
<note>
In the absence of responses, I will recommend DELETE unless it is clear
to me that it has value as a PAQ. Silence = you don't care
</note>
Cd&
Business Accounts
Answer for Membership
by: bebonhamPosted on 2001-03-29 at 07:48:18ID: 5970200
that's because it is no longer this,
tById(e.kn owdeID).st yle.left);
you passed it as 'e'
try:
if (tempX == 100)
{
//alert(document.getElemen
alert(this.knowdeID); // Seems to have forgotten which object I am on!
}
Bob