Jeg har et script JS script! Det gør at når man holder musen over noget, kommer der en lille boks frem! Problemet er: Bruger man det i iFrame registrerer den ikke hvis man scroller ned i iframe siden! Det skal jeg ha rettet, 150p til manden der kan!
Koden:
/******************************************************
* Capturing The Mouse Position in IE4-6 & NS4-6 *
* (C) 2000 www.CodeLifter.com *
* Free for all users, but leave in this header *
******************************************************/
// 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(Event.MOUSEMOVE)
// Set-up to use getMouseXY function onMouseMove
document.onmousemove = getMouseXY;
// Temporary variables to hold mouse x-y pos.s
var tempX = 0
var tempY = 0
// Main function to retrieve mouse x-y pos.s
function getMouseXY(e) {
if (IE) { // grab the x-y pos.s if browser is IE
tempX = event.clientX
tempY = event.clientY
} 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
return true
}
function clientSize() {
var myWidth = 0, myHeight = 0;
var arr;
if (typeof( window.innerWidth ) == 'number' ) {
//Non-IE
myWidth = window.innerWidth;
myHeight = window.innerHeight;
} else if( document.documentElement &&
( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
//IE 6+ in 'standards compliant mode'
myWidth = document.documentElement.clientWidth;
myHeight = document.documentElement.clientHeight;
} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
//IE 4 compatible
myWidth = document.body.clientWidth;
myHeight = document.body.clientHeight;
}
arr = new Array(myWidth, myHeight);
return arr;
}
function showHint(text)
{
var size = clientSize();
document.getElementById('hint').innerHTML = text;
/* if (!IE)
{
tempY+=window.pageYOffset;
tempX+=window.pageXOffset;
}*/
if (IE)
{
tempY+=document.getElementsByTagName("html")[0].scrollTop;
tempX+=document.getElementsByTagName("html")[0].scrollLeft;
}
tempY+=5;
size[1]+=document.getElementsByTagName("html")[0].scrollTop-30;
size[0]+=document.getElementsByTagName("html")[0].scrollLeft-20;
if (tempY+document.getElementById('hint').offsetHeight > size[1])
{
tempY = size[1]-document.getElementById('hint').offsetHeight-10;
}
if (tempX+document.getElementById('hint').offsetWidth > size[0])
{
tempX = size[0]-document.getElementById('hint').offsetWidth-0;
}
tempY += 3;
tempX += 15;
document.getElementById('hint').style.visibility='visible';
document.getElementById('hint').style.top=tempY + 'px';
document.getElementById('hint').style.left=tempX + 'px';
return true;
}
function killHint()
{
document.getElementById('hint').style.visibility='hidden';
return true;
}