Nuka
Mitglied
Ich habe wieder einige Probleme.
Ich möchte über eine Navigation aus einem Frame heraus eine Koordinate anwandern, aber leider wandert er genau an die Position mit der Koordinate X und Y im sichtbaren Bereich und nicht darunter.
Ich möchte über eine Navigation aus einem Frame heraus eine Koordinate anwandern, aber leider wandert er genau an die Position mit der Koordinate X und Y im sichtbaren Bereich und nicht darunter.
HTML:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Weltkarte</title>
<style type="text/css">
td{
width: 50;
height: 50;
}
table{
width: 1400;
height: 1500;
}
</style>
<script type="text/JavaScript">
<!--
//Status-Titel setzen
window.status = "fo-online.net - Ein Postnukleares Online-Spiel";
//-->
</script>
</head>
<body background="wmap.gif">
<img src="wmaptarg.gif" name="wmaptarg" style="left:-10;top:-10;position:absolute">
<img src="wmaploc.gif" name="wmaploc" style="left:150;top:100;position:absolute;visibility:hidden">
<img src="hotspot1.gif" name="hotspot" style="left:140;top:92;position:absolute">
<script type="text/JavaScript">
<!--
var objTarg,objLoc,objSpot,objCx,objCy;
blnRuns = false, intTimeout = 50;
IE = document.all && !window.opera;
DOM = document.getElementById;
intCols = 28;
intRows = 30;
function wmapLocation(objLocation,objEvt){
if(!IE && !DOM)
return;
objTarg = document.wmaptarg.style;
objTarg['visibility'] = 'visible';
objLoc = document.wmaploc.style;
objLoc['visibility'] = 'visible';
objSpot = document.hotspot.style;
objSpot['visibility'] = 'hidden';
clearTimeout(blnRuns);
switch(objLocation){
case 'arroyo': objCx = 165;objCy = 120;
break;
case 'klamath': objCx = 330;objCy = 120;
break;
case 'den': objCx = 420;objCy =270;
break;
case 'modoc': objCx = 420;objCy = 270;
break;
case 'gecko': objCx = 420;objCy = 270;
break;
case 'vcity': objCx = 420;objCy = 270;
break;
case 'redding': objCx = 420;objCy = 270;
break;
case 'nreno': objCx = 420;objCy = 270;
break;
case 'bhills': objCx = 420;objCy = 270;
break;
case 'ncr': objCx = 420;objCy = 270;
break;
case 'v13': objCx = 420;objCy = 270;
break;
case 'v15': objCx = 420;objCy = 270;
break;
case 'mbase': objCx = 420;objCy = 270;
break;
case 'frisco': objCx = 420;objCy = 270;
break;
case 'navarro': objCx = 420;objCy = 270;
break;
}
objTarg['left'] = (IE) ? objCx + document.body.scrollLeft : objEvt.pageX;
objTarg['top'] = (IE) ? objCy + document.body.scrollTop : objEvt.pageY;
setTimeout('wmapTrecking()',222);
}
function wmapCoordinates(objEvt){
if(!IE && !DOM)
return;
objTarg = document.wmaptarg.style;
objTarg['visibility'] = 'visible';
objLoc = document.wmaploc.style;
objLoc['visibility'] = 'visible';
objSpot = document.hotspot.style;
objSpot['visibility'] = 'hidden';
clearTimeout(blnRuns);
objTarg['left'] = (IE) ? event.clientX + document.body.scrollLeft : objEvt.pageX;
objTarg['top'] = (IE) ? event.clientY + document.body.scrollTop : objEvt.pageY;
setTimeout('wmapTrecking()',222);
}
function wmapTrecking(){
dirX = (parseInt(objLoc['left']) == parseInt(objTarg['left'])) ? 0 : (parseInt(objLoc['left']) < parseInt(objTarg['left'])) ? 1 :-1;
dirY = (parseInt(objLoc['top']) == parseInt(objTarg['top'])) ? 0 : (parseInt(objLoc['top']) < parseInt(objTarg['top'])) ? 1 :-1;
objLoc['left'] = parseInt(objLoc['left'])+ dirX + 'px';
objLoc['top'] = parseInt(objLoc['top']) + dirY + 'px';
objBody = document.getElementsByTagName('body')[0];
if(dirX == 0 && dirY == 0){
objTarg['visibility'] = 'hidden';
objLoc['visibility'] = 'hidden';
objSpot['left'] = objLoc['left'];
objSpot['top'] = objLoc['top'];
objSpot['visibility'] = 'visible';
}else{
window.scrollTo(parseInt(objLoc['left']) - ((IE) ? objBody.offsetWidth/2 : window.innerWidth / 2),parseInt(objLoc['top']) - ((IE) ? objBody.offsetHeight/2 : window.innerHeight/2));
blnRuns = setTimeout('wmapTrecking()',intTimeout);
}
}
intCell=1
document.writeln('<table cellpadding="0" cellspacing="0"><tr>');
for(r=1;r<=intRows;++r){
for(c=1;c<=intCols;++c){
document.writeln('<td id="s'+intCell+'" class="tpa"></td>');
intCell++;
}
if(r<intRows)
document.writeln('</tr><tr>');
}
document.writeln('</tr></table>');
document.onclick = wmapCoordinates;
//-->
</script>
</body>
</html>
Zuletzt bearbeitet: