Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Brauch Hilfe beim id auslesen und anderen sachen

Empfohlene Antworten

Veröffentlicht

Wir sollen als übung ein Puzzle so bearbeiten dass wenn ein teil an seine stelle gesetzt wird eine alert box kommt die sagt dass es passt .

dass ganze sieht smitlerweile so aus .

<script type="text/javascript">

var layer = 0; // zindex

var oben = new Array(50,63,63,63,63,64,108,25,107,119,121,120,178,177,122,177,178,165,223,223,235,223,234,224,279,280,292,293,293,281,350,337,337,349,353,353);

var links = new Array(150,208,266,311,369,439,137,75,252,311,381,427,150,208,30,323,369,427,135,207,265,311,369,427,137,206,264,311,382,440,137,208,264,310,369,427);

var ob = oben.lenth;

var li = links.length;

var id= "" ;

function Position() {

for (i = 0; i < 36; i++) {

with(document.getElementById("teil" + (i + 1)).style) {

position = "absolute";

top = oben + "px";

left = links + "px";

zIndex = layer++;

}

}

}

var start_drag = false;

var startY = 0;

var startX = 0;

function Init(){

document.onmousedown = StartDrag;

document.onmousemove = Drag;

document.onmouseup = EndDrag;

}

function StartDrag(Ereignis){

if(!Ereignis) {

Ereignis = window.event;

movie = Ereignis.srcElement;

}

else

movie = Ereignis.target;

var id = movie.id;

document.title = "Id: " + (id);

startY = Ereignis.screenY - movie.style.top.slice(0, movie.style.top.length -2)

startX = Ereignis.screenX - movie.style.left.slice(0, movie.style.left.length -2)

start_drag = true;

zIdex = layer++;

}

function Drag(Ereignis) {

if(!Ereignis) Ereignis = window.event;

if(start_drag){

movie.style.top = Ereignis.screenY - startY + "px";

movie.style.left = Ereignis.screenX - startX + "px";

movie.style.zIndex = layer;

}

}

function EndDrag(){

start_drag = false;

if ()

if(movie.style.top == 107+ "px" && movie.style.left == 208 + "px" )

alert("Passt");

}

</script>

</head>

<body onLoad="Position(); Init()">

<div style="position:absolute; top:0px; left:0px;">

<script type="text/javascript">

for (i = 1; i <= 36; i++) {

document.write('<img src="teil' + i + '.gif" id="teil' + i + '" onmousemove="return false;">');

}

</script>

</div>

Wie geht dass aber . Hilfe . Danke im vorraus . ich

Versuchs mal mit dieser Funktion anstatt deiner EndDrag: :bimei

function EndDrag(){

start_drag = false;

document.getElementById("teil" + (i + 1));

var pos = movie.id.substring(4,6);

pos = pos-1;

// alert(oben[pos] + "; " + links[pos]);

if(movie.style.top > (oben[pos] - 10) + "px" && movie.style.top < (oben[pos] + 10) + "px" && movie.style.left > (links[pos] - 10) + "px" && movie.style.left < (links[pos] + 10) + "px") {

alert("Passt !");

}

}

Danke Haut hin . Hat schon ne lösung so in der art war aber noch nich ganz rischtisch danke .:D

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.