...

View Full Version : [Solved] IE Help



flynch01
06-24-2008, 02:01 AM
Ok it's not as solved as I thought.


<script type="text/javascript">
var newFade = 0;
var doMouse = 0;
var doFade = 1;
document.onmousemove=getMouseCoordinates;
var scnWid,scnHei;
function setMenu() {
document.getElementById('menu').height = document.body.offsetHeight + 'px';
}
function menuOver() {
doMouse = 1;
if (doFade == 1) {
newFade = 0;
fadeIn();
}
}
function menuOut() {
doMouse = 0;
if (doFade == 0) {
newFade = 1;
fadeOut();
}
}
function fadeIn() {
newFade += 0.1;
document.getElementById('spacer').style.opacity = newFade;
document.getElementById('spacer').style.MozOpacity = newFade;
document.getElementById('spacer').style.filter = "alpha(opacity ="+ (newFade * 100) +");";
if (newFade < 1) {
setTimeout("fadeIn()", 20);
}
doFade = 0
}
function fadeOut() {
newFade -= 0.1;
document.getElementById('spacer').style.opacity = newFade;
document.getElementById('spacer').style.MozOpacity = newFade;
document.getElementById('spacer').style.filter = "alpha(opacity ="+ (newFade * 100) +");";
if (newFade > 0) {
setTimeout("fadeOut()", 20);
}
doFade = 1;
}
function getMouseCoordinates(event) {
ev = event || window.event;
if (doMouse == 1 && (ev.clientY >= 110)) {
document.getElementById('spacer').style.top = (ev.clientY - (document.getElementById('spacer').offsetHeight / 2)) + 'px';
}
}
</script>

flynch01
06-24-2008, 03:39 PM
Sorry to bump but, I'm kindof stuck until this works. No one?

tomws
06-24-2008, 03:59 PM
Have a link?

abduraooft
06-24-2008, 04:01 PM
but internet explorer doesn't even move, you may have to use ev.clientY

and also try filter property for IE, say

document.getElementById('spacer').style.filter="alpha(opacity = "+newFade+");";

flynch01
06-24-2008, 04:30 PM
I see, hold on let me try.
Edit: Thanks a million, really appreciate it!

abduraooft
06-24-2008, 04:47 PM
I see, hold on let me try.
Edit: Thanks a million, really appreciate it!You're welcome, but please keep your code there(than removing), as it may help some others.

flynch01
06-24-2008, 09:51 PM
Not so solved anymore actually. ClientX/Y is where your mouse is in relation to the window, wheras PageX/Y is in relation to the document. So if I scroll down the page, it won't be like, Y won't be 500, it'll still be where the mouse is in relation to the window. So it'll be 39 no matter how far down I scroll.

Re-pasting javavascript sorry.

I need to find out in relation to the document.

Basscyst
06-24-2008, 10:59 PM
Here is code to get mouse coordinates:



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>CF Help</title>
<script type="text/javascript">
//*******************************************************
// Mouse Co-Ords
//*******************************************************

function mouseXY(e){
if (!e){
var e = window.event;
}
if (e.clientX){
posX = e.clientX + document.documentElement.scrollLeft;
posY = e.clientY + document.documentElement.scrollTop;
}else{
posX = Math.max(e.pageX,0);
posY = Math.max(e.pageY,0);
}
var coord=new Array();
coord[0]=posX;
coord[1]=posY;
return coord;
}
if(document.captureEvents){
document.captureEvents(Event.MOUSEMOVE)
}
document.onmousemove=function(event){
var xy=mouseXY(event);
document.getElementById("coords").innerHTML=xy;
document.getElementById("coords2").innerHTML=xy;
}
</script>
</head>
<body>
<div id="coords"></div>
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<div id="coords2"></div>
</body>
</html>


Basscyst

flynch01
06-24-2008, 11:33 PM
Ah, fantastic. Thanks for that,



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum