DHTML Hedef Gösterme Kodu

<style type="text/css">
<!--
/* BODY,IMG,A {cursor:crosshair} */
-->
</style>
<script language="JavaScript1.2">
<!--
var hairColor="red";

function followmouse(e){
if (e != null) {
	hHair.style.top=e.pageY+2
	hHair.style.left=pageXOffset
	vHair.style.top=pageYOffset
	vHair.style.left=e.pageX+2
	} else {
	hHair.style.top=document.body.scrollTop+event.clientY
	hHair.style.left=document.body.scrollLeft
	vHair.style.top=document.body.scrollTop
	maxLeft=document.body.clientWidth+document.body.scrollLeft;
	if (event.clientX>maxLeft) vHair.style.left=maxLeft;
	else vHair.style.left=document.body.scrollLeft+event.clientX
	}
hHair.clip.width=window.innerWidth?innerWidth:document.body.clientWidth;
vHair.clip.height=window.innerHeight?innerHeight:document.body.clientHeight;
hHair.style.visibility='visible';
vHair.style.visibility='visible';
}

function makeDiv() {
if (document.layers) {
	newDiv=new Layer(0);
	newDiv.style=newDiv;
} else if (document.body.appendChild) {
	newDiv=document.createElement("div");
	newDiv.style.position="absolute";
	newDiv.style.visibility="hidden";
	document.body.appendChild(newDiv);
} else if (document.all) {
	thisID="div"+Math.floor(Math.random()*100000);
	document.all[document.all.length-1].innerHTML+='<div id='+thisID+' style="position:absolute;visibility:hidden;"></div><span></span>';
	newDiv=document.all[thisID];
}
if (!newDiv.clip) newDiv.clip=newDiv.style;
return newDiv;
}

function divColor(div,color) {
if (document.layers) div.bgColor=color;
else div.style.backgroundColor=color;
}

function crossHairs() {
hHair=makeDiv();
vHair=makeDiv();
divColor(hHair,hairColor);
divColor(vHair,hairColor);
hHair.style.fontSize="1px";
hHair.clip.height=1
vHair.clip.width=1
if (document.layers) { window.captureEvents(Event.MOUSEMOVE);
	window.onmousemove=followmouse;
} else document.onmousemove=followmouse;
window.onscroll=followmouse;
}

window.onload=crossHairs;
//-->
</script>