|
-
Apr 24th, 2002, 09:59 PM
#1
Thread Starter
Fanatic Member
Cursor
I want this:
Once a person onMouseOvers his cursor on one of my imgs it just automatically sets the visibility of "lyr" to visible. and the x, y of lyr follows the x,y of the cursor. so where ever the cursor moves, the lyr follows.
Please help.

prog_tom
JOIN THE REVOLUTION!!!! Dual T3 backedup science community.
http://physics.sviesoft.com/forum
-
Apr 25th, 2002, 11:11 AM
#2
Frenzied Member
Here what i did for one of our client, not the best script, but it works, in IE,NN4.x and NN6
I try quickly with opera and did'nt work, i did'nt spend the time to figure it out!
Code:
<script language="javascript">
var curLayer='';
if (document.layers) document.captureEvents(Event.MOUSEMOVE);
document.onmousemove=mtrack;
function mtrack(e) {
if(curLayer!=''){
if (document.layers){
document.layers[curLayer].left=e.pageX - 110;
document.layers[curLayer].top=e.pageY - 120;
document.layers[curLayer].visibility="show";
}else if(document.all){
document.all[curLayer].style.posLeft=event.x - 110;
document.all[curLayer].style.posTop=event.y - 120;
document.all[curLayer].style.visibility = "visible";
}else{
document.getElementById(curLayer).style.left=e.pageX - 110;
document.getElementById(curLayer).style.top=e.pageY - 120;
document.getElementById(curLayer).style.visibility = "visible";
}
}
}
function show(what){
curLayer=what;
}
function hide(what){
curLayer='';
if (document.all) {
document.all[what].style.visibility = "hidden";
document.all[what].style.posLeft=0;
document.all[what].style.posTop=0;
}else if (document.layers) {
document.layers[what].visibility="hide";
document.layers[what].left=0;
document.layers[what].top=0;
}else if (document.getElementById) {
document.getElementById(what).style.visibility="hidden";
}
}
</script>
here what you put on your image
<a href="#" onMouseOver="show('cgu');" onMouseOut="hide('cgu');"><img src="../../images/companies/cgu.gif" border="0"></a>
-
Apr 25th, 2002, 04:23 PM
#3
Thread Starter
Fanatic Member
it told me that document.all[].style is null or not an object.

prog_tom
JOIN THE REVOLUTION!!!! Dual T3 backedup science community.
http://physics.sviesoft.com/forum
-
Apr 25th, 2002, 04:43 PM
#4
Frenzied Member
well, call your layer with the name you pass the function
in my example
<div name="cgu">
dssadsd
</div>
is it ok?
-
Apr 26th, 2002, 12:52 AM
#5
For the sake of compatibility, use <DIV> and not <LAYERS> you're probably getting that error due to this and js probz (compatibility too!!)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|