Noz
Kontakt

·

ePaper

·

Shop

·

Tippspiel

Startseite

|

ON Memo

Schrift
 Drucken  Versenden Empfehlen auf:      

ON Memo

– Anzeige – Ihre Anzeige hier



Meistgelesene Artikel








var usedCards = new Array() var cardNames = new Array('1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24'); var cardImages = new Array(); var cardValues = new Array(); var usedCardsName = new Array(); var openCards = 0; var isOpenCard = -1; var is2ndOpenCard = -1; var checkedCards = new Array(); var right = 0; var wrong = 0; var cntImages = 14; var cntCards = memwidth*memheight; var cntPairs = cntCards/2; var time, timeInterval; var penalty = 5; var m, s, pen; function status(value){ document.getElementById('status').innerHTML = value; } function addPenalty() { if(pen > 0) { time--; incTimer(); pen--; window.setTimeout("addPenalty()", 50); } } function startTimer(){ if(timeInterval)window.clearIntervall(timeInterval); time = new Date().getTime(); time = Math.round(time/1000); timeInterval = window.setInterval("incTimer()", 1000); } function incTimer(){ var ntime = new Date().getTime(); ntime = Math.round(ntime/1000); var dif = ntime - time; timer(dif); } function timer(dif){ s = dif%60; m = (dif-s)/60; document.getElementById("timer").innerHTML = m + ":" + (s > 9 ? s : "0" + s); } // eTracker Workaround function refreshtracker() { var src = document.getElementById('memoTracking').src; document.getElementById('memoTracking').src = src; } function xalert(str) { document.getElementById('debug').value+=str; } function xshuffleArray(arr) { var high, here, swap; for (high=arr.length-1; high>0; high--) { here = Math.floor(Math.random()*(high+1)); //random number will fall between 0-high // alert("hi:"+high + ", here:" + here); swap = arr[here]; arr[here] = arr[high]; arr[high] = swap; } } function shuffleArray(arr,arr2) { var j,swap; for(i=0; i<=arr.length-1; i++) { j=Math.floor(Math.random()*cntPairs); swap = arr[i]; arr[i] = arr[j]; arr[j] = swap; //shuffle 2nd array in same order if(arr2) { swap = arr2[i]; arr2[i] = arr2[j]; arr2[j] = swap; } } } function init() { startTimer(); request("response", "init=1", "cntCards="+cntCards); generateCardTable(); // Spielstand auf Null setzen und Variablen initialisieren //document.getElementById('right').innerHTML = 0; //document.getElementById('wrong').innerHTML = 0; var openCards = 0; var isOpenCard = -1; var is2ndOpenCard = -1; //festlegen, welche Karten verwendet werden for(i=0; i= cntPairs-1) { j=-1; } j++; // init checkedCards[i] = 0; img = document.getElementById("img_" + i); img.className = "card_0"; img.title = ""; } shuffleArray(cardValues); //closeAllUncheckedCards(); status("Los gehts."); document.getElementById('restart').disabled = false; } // Ende der function init() function setCardStyle(imgId,stat) { if(imgId == -1) { for(i=0; i<=(memwidth*memheight-1); i++) { if(checkedCards[i] != 1) document.getElementById("img_" + i).className = "card_" + stat; } } else { document.getElementById("img_" + imgId).className = "card_" + stat; } } function clickCard(imgId) { //alert(imgId); if((isOpenCard == imgId && openCards != 2) || checkedCards[imgId] == 1) { // nichts return; } else if(openCards == 2) { // Klick zum Weiterspielen playSound('click'); setCardStyle(-1,0); openCards = 0; isOpenCard = -1; //is2ndOpenCard = -1; closeAllUncheckedCards(); status("Karte waehlen..."); return; } else if(openCards == 1) { // zweite Karte aufdecken status("..."); document.getElementById("img_" + imgId).className = 'card_1'; setCardStyle(-1,1); try { document.getElementById("img_" + imgId).src = cardImages[cardValues[imgId]].src; } catch(e) { alert("imgId: "+imgId+", cardValues[imgId]: "+cardValues[imgId]); } if(cardValues[isOpenCard] == cardValues[imgId]) { // Richtig playSound('right'); status("Richtig.
Naechste Karte waehlen ..."); right++; //document.getElementById('right').innerHTML = right; request("response", "card=" + cardValues[imgId], "r="+right); if(right == memwidth*memheight/2) { // gewonnen window.clearInterval(timeInterval); playSound('completed'); var num = right+wrong;//parseInt(document.getElementById('right').innerHTML) + parseInt(document.getElementById('wrong').innerHTML); var pairs = memwidth*memheight/2; var perc = Math.round((3*pairs-num)*100/(3*pairs-pairs)); var name = prompt("Bitte geben Sie Ihren Namen ein:", ""); request("response", 'name='+name, null, ''); window.setTimeout('location.reload()', 1500); //var perc = num * 100 / (memwidth*memheight/2); status("Fertig.
" + num + " Versuche, " + perc + "%."); } checkedCards[imgId] = 1; checkedCards[isOpenCard] = 1; setCardStyle(-1,0); openCards = 0; isOpenCard = -1; //is2ndOpenCard = -1; closeAllUncheckedCards(); return; } else { wrong++; document.getElementById('penalty').innerHTML = (wrong*penalty) + " Sek"; pen = penalty; addPenalty(); playSound('wrong'); status("Falsch.
Zum Weiterspielen klicken..."); //document.getElementById('wrong').innerHTML = wrong; request("response", "card=" + cardValues[imgId], "w=" + wrong); } } else if(openCards == 0) { // erste Karte aufdecken playSound('click'); status("zweite Karte waehlen ..."); request("response", "card=" + cardValues[imgId], ""); //document.getElementById("img_" + imgId).className = 'card_1'; setCardStyle(imgId,1); //alert(cardValues[imgId]); //alert(cardImages[cardValues[imgId]]); document.getElementById("img_" + imgId).src = cardImages[cardValues[imgId]].src; isOpenCard = imgId; //openCards = 1; } openCards++; } function closeAllUncheckedCards() { for(i=0; i<=(memwidth*memheight-1); i++) { if(checkedCards[i] != 1) { document.getElementById("img_" + i).src = cardImageBack.src; } } } function generateCardTableOnStartUp() { var imgId = 0; document.write(""); for(i=1; i<=memheight; i++) { document.write(""); for(j=1; j<=memwidth; j++) { //document.write(""); document.write(""); imgId++; } document.write(""); } document.write("
" + i + ", " + j + "
"); } function generateCardTable() { var imgId = 0; var ret = ""; for(i=1; i<=memheight; i++) { ret += ""; for(j=1; j<=memwidth; j++) { //document.write(""); ret += ""; imgId++; } ret += ""; } ret += "
" + i + ", " + j + "
"; document.getElementById('board').innerHTML = ret; } function playSound(soundname) { // Funktioniert anscheinend nur im MSIE if(navigator.appName != 'Microsoft Internet Explorer') return; if(document.getElementById('sound_' + soundname)) document.getElementById('sound_' + soundname).play(); }

Empfehlen auf:  Facebook  Twitter

Thumbnail_0
Ich verkaufe hier ein gut erhaltenes Stofftier, welches die Ente Donald Duck darstellt. Ca. 30 cm hoch. Es soll 3,- €...
Thumbnail_0
Bine ist ca. 2 Jahre alt. Hinter ihr liegt ein trauriges Schicksal.Sie hat in der Gruppe gelebt und Hunger und Not...
Thumbnail_0
unsere kastratin , sofort abzugeben. Muri ist geimft, entwürmt und schon kastriert, Nur kastration eine Katze -...






 Zeitungstitel wählen  Schließen

Wählen Sie Ihren Zeitungstitel: