View Single Post
Old 10-05-2012, 09:52 PM   PM User | #1
gocats2
New to the CF scene

 
Join Date: Oct 2012
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
gocats2 is an unknown quantity at this point
Need help fine-tuning a popup box

I am inserting a popup box that is activated on mouse over. When the mouse is moved away from the link the box goes away. I am happy to finally have a popup that works at all (after many tries) but would like it to display on mouse over and also allow the cursor to move into the box and keep the box open as long as the cursor is there. I want to put a couple of links in the box to take visitors to other pages. The way it is now, this is not possible. It would be helpful if the box went away when the cursor was moved from the box rather than the visitor having to click to close. I have never used java script before in my webpages and I'm not sure where to insert code that would make it work the way I want. I have added the current code below. Thank you for any help you can give me.

[CODE]<script type="text/javascript" language="JavaScript">
var cX = 0; var cY = 0; var rX = 0; var rY = 0;
function UpdateCursorPosition(e){ cX = e.pageX; cY = e.pageY;}
function UpdateCursorPositionDocAll(e){ cX = event.clientX; cY = event.clientY;}
if(document.all) { document.onmousemove = UpdateCursorPositionDocAll; }
else { document.onmousemove = UpdateCursorPosition; }
function AssignPosition(d) {
if(self.pageYOffset) {
rX = self.pageXOffset;
rY = self.pageYOffset;
}
else if(document.documentElement && document.documentElement.scrollTop) {
rX = document.documentElement.scrollLeft;
rY = document.documentElement.scrollTop;
}
else if(document.body) {
rX = document.body.scrollLeft;
rY = document.body.scrollTop;
}
if(document.all) {
cX += rX;
cY += rY;
}
d.style.left = (cX+10) + "px";
d.style.top = (cY+10) + "px";
}
function HideText(d) {
if(d.length < 1) { return; }
document.getElementById(d).style.display = "none";
}
function ShowText(d) {
if(d.length < 1) { return; }
var dd = document.getElementById(d);
AssignPosition(dd);
dd.style.display = "block";
}
function ReverseContentDisplay(d) {
if(d.length < 1) { return; }
var dd = document.getElementById(d);
AssignPosition(dd);
if(dd.style.display == "none") { dd.style.display = "block"; }
else { dd.style.display = "none"; }
}
//-->
</script>[CODE]
gocats2 is offline   Reply With Quote