stephaneeybert
asked on
Why the callback onMouseOut() is called?
Dear All,
I'm doing a little javascript to have some popup text appearing when the user passes the mouse cursor over a portion of text. The problem I experience is that the onMouseOut() callback is called non-stop even if the mouse cursor does not leave the portion of text.
Any idea?
Regards
Stephane/Stockholm
Here is the html source code:
<HTML>
<HEAD>
<SCRIPT LANGUAGE="javascript" SRC="../lib/browser.js"></ SCRIPT>
<SCRIPT LANGUAGE="javascript" SRC="../lib/mouseEvents.js "></SCRIPT >
<SCRIPT LANGUAGE="Javascript" SRC="../lib/element.js"></ SCRIPT>
<SCRIPT LANGUAGE="Javascript" SRC="over.js"></SCRIPT>
</HEAD>
<BODY>
<script language="JavaScript">
<!--
var bgcolor = "#ffcc00";
var bdcolor = "#000000";
var textcolor = "#000000";
var titlecolor = "#ffffff";
var width = "100";
var border = "5";
// -->
</script>
<A HREF="over.html" onMouseOver="popup('A popup.');" onMouseOut="popupOff();">A popup</A>
<BR><BR>
<A HREF="over.html" onMouseOver="titledPopup(' A popup.','The title');" onMouseOut="popupOff();">A titled popup</A>
</BODY>
</HTML>
Here is the javascript source code:
// Runs the function at loading time
onLoad = initOver();
// Main initializer
function initOver() {
// Initialize the mouse event manager
initMouseEvent();
// Create the popup object
over = new docElement(window, "over", "", 400, 50);
over.output();
// Set the colors and positions
if (typeof bgcolor == 'undefined') { bgcolor = "#CCCCFF";}
if (typeof bdcolor == 'undefined') { bdcolor = "#333399";}
if (typeof textcolor == 'undefined') { textcolor = "#000000";}
if (typeof titlecolor == 'undefined') { titlecolor = "#FFFFFF";}
if (typeof width == 'undefined') { width = "200";}
if (typeof border == 'undefined') { border = "1";}
// Set the flag variable
shown = false;
}
// Display a popup text
function popup(text) {
var txt = "<TABLE WIDTH="+width+" BORDER=0 CELLPADDING="+border+" CELLSPACING=0 BGCOLOR=\""+bdcolor+"\"><T R><TD><TAB LE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=0 BGCOLOR=\""+bgcolor+"\"><T R><TD><FON T FACE=\"Arial,Helvetica\" COLOR=\""+textcolor+"\" SIZE=\"-2\">"+text+"</FONT ></TD></TR ></TABLE>< /TD></TR>< /TABLE>"
show(txt);
}
// Display a popup text with a title
function titledPopup(text, title) {
var txt = "<TABLE WIDTH="+width+" BORDER=0 CELLPADDING="+border+" CELLSPACING=0 BGCOLOR=\""+bdcolor+"\"><T R><TD><TAB LE WIDTH=100% BORDER=0 CELLPADDING=0 CELLSPACING=0><TR><TD><SPA N ID=\"PTT\"><B><FONT COLOR=\""+titlecolor+"\">" +title+"</ FONT></B>< /SPAN></TD ></TR></TA BLE><TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=0 BGCOLOR=\""+bgcolor+"\"><T R><TD><SPA N ID=\"PST\"><FONT COLOR=\""+textcolor+"\">"+ text+"</FO NT><SPAN>< /TD></TR>< /TABLE></T D></TR></T ABLE>"
show(txt);
}
// Manage the mouse moves
function mouseMove(e) {
mousePos(e);
over.moveTo(mouseX - (width / 2), mouseY);
return true;
}
// Close the popup
function popupOff() {
alert("Nooooo....");
hide();
}
// Show the popup
function show(txt) {
if (shown == false) {
over.setBody(txt);
over.moveTo(mouseX - (width / 2), mouseY);
over.show();
shown = true;
}
}
// Hide the popup
function hide() {
if (shown == true) {
over.hide();
shown = false;
}
}
// Called if mouse button is pressed
function mouseDown(e) {
}
// Called if mouse button is released
function mouseUp(e) {
}
I'm doing a little javascript to have some popup text appearing when the user passes the mouse cursor over a portion of text. The problem I experience is that the onMouseOut() callback is called non-stop even if the mouse cursor does not leave the portion of text.
Any idea?
Regards
Stephane/Stockholm
Here is the html source code:
<HTML>
<HEAD>
<SCRIPT LANGUAGE="javascript" SRC="../lib/browser.js"></
<SCRIPT LANGUAGE="javascript" SRC="../lib/mouseEvents.js
<SCRIPT LANGUAGE="Javascript" SRC="../lib/element.js"></
<SCRIPT LANGUAGE="Javascript" SRC="over.js"></SCRIPT>
</HEAD>
<BODY>
<script language="JavaScript">
<!--
var bgcolor = "#ffcc00";
var bdcolor = "#000000";
var textcolor = "#000000";
var titlecolor = "#ffffff";
var width = "100";
var border = "5";
// -->
</script>
<A HREF="over.html" onMouseOver="popup('A popup.');" onMouseOut="popupOff();">A
<BR><BR>
<A HREF="over.html" onMouseOver="titledPopup('
</BODY>
</HTML>
Here is the javascript source code:
// Runs the function at loading time
onLoad = initOver();
// Main initializer
function initOver() {
// Initialize the mouse event manager
initMouseEvent();
// Create the popup object
over = new docElement(window, "over", "", 400, 50);
over.output();
// Set the colors and positions
if (typeof bgcolor == 'undefined') { bgcolor = "#CCCCFF";}
if (typeof bdcolor == 'undefined') { bdcolor = "#333399";}
if (typeof textcolor == 'undefined') { textcolor = "#000000";}
if (typeof titlecolor == 'undefined') { titlecolor = "#FFFFFF";}
if (typeof width == 'undefined') { width = "200";}
if (typeof border == 'undefined') { border = "1";}
// Set the flag variable
shown = false;
}
// Display a popup text
function popup(text) {
var txt = "<TABLE WIDTH="+width+" BORDER=0 CELLPADDING="+border+" CELLSPACING=0 BGCOLOR=\""+bdcolor+"\"><T
show(txt);
}
// Display a popup text with a title
function titledPopup(text, title) {
var txt = "<TABLE WIDTH="+width+" BORDER=0 CELLPADDING="+border+" CELLSPACING=0 BGCOLOR=\""+bdcolor+"\"><T
show(txt);
}
// Manage the mouse moves
function mouseMove(e) {
mousePos(e);
over.moveTo(mouseX - (width / 2), mouseY);
return true;
}
// Close the popup
function popupOff() {
alert("Nooooo....");
hide();
}
// Show the popup
function show(txt) {
if (shown == false) {
over.setBody(txt);
over.moveTo(mouseX - (width / 2), mouseY);
over.show();
shown = true;
}
}
// Hide the popup
function hide() {
if (shown == true) {
over.hide();
shown = false;
}
}
// Called if mouse button is pressed
function mouseDown(e) {
}
// Called if mouse button is released
function mouseUp(e) {
}
ASKER
I tried that but it didn't work. Same with "return false".
What I mean is, the onMouseOver should be called once, when the mouse enters the text area, and the onMouseOut should be called once, when the mouse leaves the text area. But the two are called non stop when I run the mouse within the text area. The text area is the portion of the page that contains the link.
In my two examples, it is:
"A popup" and "A titled popup".
What I mean is, the onMouseOver should be called once, when the mouse enters the text area, and the onMouseOut should be called once, when the mouse leaves the text area. But the two are called non stop when I run the mouse within the text area. The text area is the portion of the page that contains the link.
In my two examples, it is:
"A popup" and "A titled popup".
ASKER
I have put all the source code, that is, the html part, and the javascript part.
I suggest you save the html part in a file, and the javascript part inanother file. To run it, I also include here the libraries I'm using.
The first file is browser.js...
// Functions attached to the browsers
// Check if NS4 browser
function ns4Browser() {
return(nsBrowser());
}
// Check if NS browser
function nsBrowser() {
return((document.layers) ? true : false);
}
// Check if IE4 browser
function ie4Browser() {
if (ieBrowser()) {
if (navigator.userAgent.index Of('MSIE 4')>0) {
return(true);
} else {
return(false);
}
} else {
return(false);
}
}
// Check if IE browser
function ieBrowser() {
return((document.all) ? true : false);
}
// Check if IE5 browser
function ie5Browser() {
if (ieBrowser()) {
if (navigator.userAgent.index Of('MSIE 5')>0) {
return(true);
} else {
return(false);
}
} else {
return(false);
}
}
// Check if MAC browser
function macBrowser() {
return(navigator.appVersio n.indexOf( "Mac") != -1);
}
// Check if Dynamic HTML browser
function dhtmlBrowser() {
return(ns4Browser() || (ie4Browser() && !macBrowser()));
}
// Check if the browser supports images swapping (IE3 does not)
function imageSwapBrowser (InString) {
if (document.images) {
return(true);
} else {
return(false);
}
}
// Return an object from an html id
function idToObject(id) {
if (ie4Browser()) {
return(document.all[id].st yle);
} else if(ns4Browser()) {
return(document.layers[id] );
}
}
// Return an object from an html id
function idToObject2(id) {
// First we initialize all the variables.
var object,ss,sr,i,j;
// This chunk handles the IE portion of the checkIn code.
if (ie4Browser()) {
var mylayers=new Array();
if((document.all[id].style .position != 'absolute') && (document.all[id].style.po sition != 'relative')){
for (ss=0 ; ss < document.styleSheets.lengt h; ss++) {
for (sr=0 ; sr < document.styleSheets(ss).r ules.lengt h; sr++) {
if (document.styleSheets(ss). rules(sr). selectorTe xt == '#' + id) {
object = document.styleSheets(ss).r ules(sr).s tyle;
break;
}
}
}
} else {
object = document.all[id].style;
}
} else if(ns4Browser()) {
var mylayers = new Array();
with (document) {
for (i=0; i<layers.length; i++) mylayers[i]=layers[i]; {
for (i=0; i<mylayers.length; i++) {
if (mylayers[i].document && mylayers[i].document.layer s) {
for (j=0; j<mylayers[i].document.lay ers.length ; j++) {
mylayers[mylayers.length] = mylayers[i].document.layer s[j];
}
if(mylayers[i].name == id){
object = mylayers[i];
}
}
}
}
}
}
return(object);
}
// Show an object
function showObject(object) {
if (ns4Browser()) {
object.visibility = "show";
} else if (ie4Browser()) {
object.visibility = "visible";
}
}
// Hide an object
function hideObject(object) {
if (ns4Browser()) {
object.visibility = "hide";
} else if (ie4Browser()) {
object.visibility = "hidden";
}
}
// Move an object
function moveObjectTo(object, x, y) {
object.left = x;
object.top = y;
}
// Move an object
function moveObjectBy(object, x, y) {
object.left = obj.left + x;
object.top = obj.top + y;
}
// Set the html body for an object
function setObjectBody(object, body) {
if (ie4Browser()) {
document.all.object.innerH TML = body;
} else if (ns4Browser()) {
with (document.layers[object]) {
open();
writeln(body);
close();
}
}
}
The second file is mouseEvents.js...
// Functions to manage the mouse and associated events
// Initializes the mouse events
function initMouseEvent() {
// Specify the function callback names to the event manager
document.onmousemove = mouseMove
document.onmousedown = mouseDown;
document.onmouseup = mouseUp;
if (nsBrowser()) document.captureEvents(Eve nt.MOUSEDO WN | Event.MOUSEMOVE | Event.MOUSEUP | Event.MOUSEDRAG)
// Reset the mouse position
mouseX = 0;
mouseY = 0;
}
// Get the position of the mouse
function mousePos(e) {
var x, y;
if (nsBrowser()) {
x = e.pageX;
y = e.pageY;
x = x + window.pageXOffset;
y = y + window.pageYOffset;
} else if (ieBrowser()) {
x = e.x;
y = e.y;
x = x + document.body.scrollLeft;
y = y + document.body.scrollTop;
}
// Check the mouse position against the inner border of the window
if (x < window.innerWidth && y < window.innerHeight) {
mouseX = x;
mouseY = y;
}
}
// Checks if the position of the mouse is inside an object
function mouseInObject(e, obj) {
mousePos(e);
if (mouseX >= obj.left && mouseX <= (obj.left + obj.document.width) && mouseY >= obj.top && mouseY <= (obj.top + obj.document.height)) {
return(true);
} else {
return(false);
}
}
The third file is element.js...
// Functions to manage the document elements
// Constructor for an element
function docElement(window, id, body, left, top) {
// Remember some arguments for later use
this.window = window;
this.id = id;
this.body = body;
// Write a CSSP style sheet for the element
var doc = window.document;
doc.writeln('<STYLE TYPE="text/css">');
doc.writeln('#' + id + ' {');
doc.writeln(' position:absolute;');
if (left) {
doc.writeln(' left:' + left + ';');
}
if (top) {
doc.writeln(' top:' + top + ';');
}
doc.writeln(' }');
doc.writeln('</STYLE>');
}
// Functions of a docElement - NS version
if (nsBrowser()) {
/////////////////////// NETSCAPE BROWSER ////////////////////////// ////////// /////
// Output the element
// This function must be called first, to create the element tags in the html page
docElement.prototype.outpu t = function () {
var doc = this.window.document;
// Output the element within a <DIV> tag
doc.writeln('<DIV ID="' + this.id + '">');
doc.writeln(this.body);
doc.writeln("</DIV>");
// Save a reference to the layer of the element
this.layer = doc[this.id];
}
// Show the element
docElement.prototype.show = function(x, y) {
this.layer.visibility = "show";
}
// Hide the element
docElement.prototype.hide = function(x, y) {
this.layer.visibility = "hide";
}
// Move the element
docElement.prototype.moveT o = function(x, y) {
this.layer.moveTo(x, y);
}
// Move the element
docElement.prototype.moveB y = function(x, y) {
this.layer.moveBy(x, y);
}
// Set the stacking order of the element
docElement.prototype.setSt ackingOrde r = function(z) {
this.layer.zIndex = z;
}
// Set the background color of the element
docElement.prototype.setBg Color = function(color) {
this.layer.bgColor = color;
}
// Set the background image of the element
docElement.prototype.setBg Image = function(image) {
this.layer.background.src = image;
}
// Change the content of the html body of the element
docElement.prototype.setBo dy = function() {
for (var i = 0; i < arguments.length; i++) {
this.layer.document.writel n(argument s[i]);
}
this.layer.document.close( );
}
// Get the left position of the element
docElement.prototype.getLe ft = function() {
return (this.layer.left);
}
// Get the top position of the element
docElement.prototype.getTo p = function() {
return (this.layer.top);
}
// Get the width of the element
docElement.prototype.getWi dth = function() {
return (this.layer.width);
}
// Get the height of the element
docElement.prototype.getHe ight = function() {
return (this.layer.height);
}
// Get the stacking order of the element
docElement.prototype.getSt ackingOrde r = function() {
return (this.layer.zIndex);
}
// Get the visibility (Returns true/false) of the element
docElement.prototype.isVis ible = function() {
return (this.layer.visibility == "show");
}
/////////////////////// MICROSOFT BROWSER ////////////////////////// ////////// /////
} else if (ieBrowser()) {
// Output the element
// This function must be called first, to create the element tags in the html page
docElement.prototype.outpu t = function () {
var doc = this.window.document;
// Output the element within a <DIV> tag
doc.writeln('<DIV ID="' + this.id + '">');
doc.writeln(this.body);
doc.writeln("</DIV>");
// Save a reference to the layer of the element
this.element = doc.all[this.id];
this.style = this.element.style;
}
// Show the element
docElement.prototype.show = function(x, y) {
this.style.visibility = "visible";
}
// Hide the element
docElement.prototype.hide = function(x, y) {
this.style.visibility = "hidden";
}
// Move the element
docElement.prototype.moveT o = function(x, y) {
this.style.pixelLeft = x;
this.style.pixelTop = y;
}
// Move the element
docElement.prototype.moveB y = function(x, y) {
this.style.pixelLeft += x;
this.style.pixelTop += y;
}
// Set the stacking order of the element
docElement.prototype.setSt ackingOrde r = function(z) {
this.style.zIndex = z;
}
// Set the background color of the element
docElement.prototype.setBg Color = function(color) {
this.style.backgroundColor = color;
}
// Set the background image of the element
docElement.prototype.setBg Image = function(image) {
this.style.backgroundImage = image;
}
// Change the content of the html body of the element
docElement.prototype.setBo dy = function() {
var body = "";
for (var i = 0; i < arguments.length; i++) {
body += arguments[i] + "\n";
}
this.element.innerHTML = body;
}
// Get the left position of the element
docElement.prototype.getLe ft = function() {
return (this.style.pixelLeft);
}
// Get the top position of the element
docElement.prototype.getTo p = function() {
return (this.style.pixelTop);
}
// Get the width of the element
docElement.prototype.getWi dth = function() {
return (this.style.width);
}
// Get the height of the element
docElement.prototype.getHe ight = function() {
return (this.style.height);
}
// Get the stacking order of the element
docElement.prototype.getSt ackingOrde r = function() {
return (this.style.zIndex);
}
// Get the visibility (Returns true/false) of the element
docElement.prototype.isVis ible = function() {
return (this.style.visibility == "visible");
}
}
I suggest you save the html part in a file, and the javascript part inanother file. To run it, I also include here the libraries I'm using.
The first file is browser.js...
// Functions attached to the browsers
// Check if NS4 browser
function ns4Browser() {
return(nsBrowser());
}
// Check if NS browser
function nsBrowser() {
return((document.layers) ? true : false);
}
// Check if IE4 browser
function ie4Browser() {
if (ieBrowser()) {
if (navigator.userAgent.index
return(true);
} else {
return(false);
}
} else {
return(false);
}
}
// Check if IE browser
function ieBrowser() {
return((document.all) ? true : false);
}
// Check if IE5 browser
function ie5Browser() {
if (ieBrowser()) {
if (navigator.userAgent.index
return(true);
} else {
return(false);
}
} else {
return(false);
}
}
// Check if MAC browser
function macBrowser() {
return(navigator.appVersio
}
// Check if Dynamic HTML browser
function dhtmlBrowser() {
return(ns4Browser() || (ie4Browser() && !macBrowser()));
}
// Check if the browser supports images swapping (IE3 does not)
function imageSwapBrowser (InString) {
if (document.images) {
return(true);
} else {
return(false);
}
}
// Return an object from an html id
function idToObject(id) {
if (ie4Browser()) {
return(document.all[id].st
} else if(ns4Browser()) {
return(document.layers[id]
}
}
// Return an object from an html id
function idToObject2(id) {
// First we initialize all the variables.
var object,ss,sr,i,j;
// This chunk handles the IE portion of the checkIn code.
if (ie4Browser()) {
var mylayers=new Array();
if((document.all[id].style
for (ss=0 ; ss < document.styleSheets.lengt
for (sr=0 ; sr < document.styleSheets(ss).r
if (document.styleSheets(ss).
object = document.styleSheets(ss).r
break;
}
}
}
} else {
object = document.all[id].style;
}
} else if(ns4Browser()) {
var mylayers = new Array();
with (document) {
for (i=0; i<layers.length; i++) mylayers[i]=layers[i]; {
for (i=0; i<mylayers.length; i++) {
if (mylayers[i].document && mylayers[i].document.layer
for (j=0; j<mylayers[i].document.lay
mylayers[mylayers.length] = mylayers[i].document.layer
}
if(mylayers[i].name == id){
object = mylayers[i];
}
}
}
}
}
}
return(object);
}
// Show an object
function showObject(object) {
if (ns4Browser()) {
object.visibility = "show";
} else if (ie4Browser()) {
object.visibility = "visible";
}
}
// Hide an object
function hideObject(object) {
if (ns4Browser()) {
object.visibility = "hide";
} else if (ie4Browser()) {
object.visibility = "hidden";
}
}
// Move an object
function moveObjectTo(object, x, y) {
object.left = x;
object.top = y;
}
// Move an object
function moveObjectBy(object, x, y) {
object.left = obj.left + x;
object.top = obj.top + y;
}
// Set the html body for an object
function setObjectBody(object, body) {
if (ie4Browser()) {
document.all.object.innerH
} else if (ns4Browser()) {
with (document.layers[object]) {
open();
writeln(body);
close();
}
}
}
The second file is mouseEvents.js...
// Functions to manage the mouse and associated events
// Initializes the mouse events
function initMouseEvent() {
// Specify the function callback names to the event manager
document.onmousemove = mouseMove
document.onmousedown = mouseDown;
document.onmouseup = mouseUp;
if (nsBrowser()) document.captureEvents(Eve
// Reset the mouse position
mouseX = 0;
mouseY = 0;
}
// Get the position of the mouse
function mousePos(e) {
var x, y;
if (nsBrowser()) {
x = e.pageX;
y = e.pageY;
x = x + window.pageXOffset;
y = y + window.pageYOffset;
} else if (ieBrowser()) {
x = e.x;
y = e.y;
x = x + document.body.scrollLeft;
y = y + document.body.scrollTop;
}
// Check the mouse position against the inner border of the window
if (x < window.innerWidth && y < window.innerHeight) {
mouseX = x;
mouseY = y;
}
}
// Checks if the position of the mouse is inside an object
function mouseInObject(e, obj) {
mousePos(e);
if (mouseX >= obj.left && mouseX <= (obj.left + obj.document.width) && mouseY >= obj.top && mouseY <= (obj.top + obj.document.height)) {
return(true);
} else {
return(false);
}
}
The third file is element.js...
// Functions to manage the document elements
// Constructor for an element
function docElement(window, id, body, left, top) {
// Remember some arguments for later use
this.window = window;
this.id = id;
this.body = body;
// Write a CSSP style sheet for the element
var doc = window.document;
doc.writeln('<STYLE TYPE="text/css">');
doc.writeln('#' + id + ' {');
doc.writeln(' position:absolute;');
if (left) {
doc.writeln(' left:' + left + ';');
}
if (top) {
doc.writeln(' top:' + top + ';');
}
doc.writeln(' }');
doc.writeln('</STYLE>');
}
// Functions of a docElement - NS version
if (nsBrowser()) {
/////////////////////// NETSCAPE BROWSER //////////////////////////
// Output the element
// This function must be called first, to create the element tags in the html page
docElement.prototype.outpu
var doc = this.window.document;
// Output the element within a <DIV> tag
doc.writeln('<DIV ID="' + this.id + '">');
doc.writeln(this.body);
doc.writeln("</DIV>");
// Save a reference to the layer of the element
this.layer = doc[this.id];
}
// Show the element
docElement.prototype.show = function(x, y) {
this.layer.visibility = "show";
}
// Hide the element
docElement.prototype.hide = function(x, y) {
this.layer.visibility = "hide";
}
// Move the element
docElement.prototype.moveT
this.layer.moveTo(x, y);
}
// Move the element
docElement.prototype.moveB
this.layer.moveBy(x, y);
}
// Set the stacking order of the element
docElement.prototype.setSt
this.layer.zIndex = z;
}
// Set the background color of the element
docElement.prototype.setBg
this.layer.bgColor = color;
}
// Set the background image of the element
docElement.prototype.setBg
this.layer.background.src = image;
}
// Change the content of the html body of the element
docElement.prototype.setBo
for (var i = 0; i < arguments.length; i++) {
this.layer.document.writel
}
this.layer.document.close(
}
// Get the left position of the element
docElement.prototype.getLe
return (this.layer.left);
}
// Get the top position of the element
docElement.prototype.getTo
return (this.layer.top);
}
// Get the width of the element
docElement.prototype.getWi
return (this.layer.width);
}
// Get the height of the element
docElement.prototype.getHe
return (this.layer.height);
}
// Get the stacking order of the element
docElement.prototype.getSt
return (this.layer.zIndex);
}
// Get the visibility (Returns true/false) of the element
docElement.prototype.isVis
return (this.layer.visibility == "show");
}
/////////////////////// MICROSOFT BROWSER //////////////////////////
} else if (ieBrowser()) {
// Output the element
// This function must be called first, to create the element tags in the html page
docElement.prototype.outpu
var doc = this.window.document;
// Output the element within a <DIV> tag
doc.writeln('<DIV ID="' + this.id + '">');
doc.writeln(this.body);
doc.writeln("</DIV>");
// Save a reference to the layer of the element
this.element = doc.all[this.id];
this.style = this.element.style;
}
// Show the element
docElement.prototype.show = function(x, y) {
this.style.visibility = "visible";
}
// Hide the element
docElement.prototype.hide = function(x, y) {
this.style.visibility = "hidden";
}
// Move the element
docElement.prototype.moveT
this.style.pixelLeft = x;
this.style.pixelTop = y;
}
// Move the element
docElement.prototype.moveB
this.style.pixelLeft += x;
this.style.pixelTop += y;
}
// Set the stacking order of the element
docElement.prototype.setSt
this.style.zIndex = z;
}
// Set the background color of the element
docElement.prototype.setBg
this.style.backgroundColor
}
// Set the background image of the element
docElement.prototype.setBg
this.style.backgroundImage
}
// Change the content of the html body of the element
docElement.prototype.setBo
var body = "";
for (var i = 0; i < arguments.length; i++) {
body += arguments[i] + "\n";
}
this.element.innerHTML = body;
}
// Get the left position of the element
docElement.prototype.getLe
return (this.style.pixelLeft);
}
// Get the top position of the element
docElement.prototype.getTo
return (this.style.pixelTop);
}
// Get the width of the element
docElement.prototype.getWi
return (this.style.width);
}
// Get the height of the element
docElement.prototype.getHe
return (this.style.height);
}
// Get the stacking order of the element
docElement.prototype.getSt
return (this.style.zIndex);
}
// Get the visibility (Returns true/false) of the element
docElement.prototype.isVis
return (this.style.visibility == "visible");
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks Josh. But can I ask you for a little more clarification?
You're saying the problem is that the popup "is coming underneath the mouse".
You then suggest to have "the popup below the mouse".
I'm trying to picture a difference between the two options. And how can I make the popup to appear below the mouse?
Again, thanks.
Stephane
You're saying the problem is that the popup "is coming underneath the mouse".
You then suggest to have "the popup below the mouse".
I'm trying to picture a difference between the two options. And how can I make the popup to appear below the mouse?
Again, thanks.
Stephane
Sorry about being unclear. When the popup is created, offset it's y coordinate by about 10 pixels so that the popup window appears 10 pixels below the mouse cursor. This should fix the problem.
-Josh
-Josh
ASKER
Thanks so much my friend.
You're very much welcome!
onMouseOver="popup('A popup.');return true;" onMouseOut="popupOff();ret
I'm not sure what you exactly mean though.
Justus