<table width="580" height="250" class="colorborder" align="center"> <tr><td style="vertical-align: middle;" align="center" height="50" colspan="3"> <div align="center" id="liteman1krug">3 круга</div> </td></tr> <tr> <td width="5">|</td> <td style="vertical-align: middle;" align="left" id="liteman1pacmanpanel" height="90"> <input id="liteman1idpacmancheck" type="checkbox" hidden/> <img style="height: 72px; position: absolute; z-index: 25; top: 0px; left: 0px; cursor:pointer;" id="liteman1impacman2" onclick="liteman1MStart(1)" src="/Scr/pacman/liteman1imagepicman1.png" > </td> <td width="5">|</td> </tr> <tr> <td width="5">|</td> <td style="vertical-align: middle;" align="left" id="liteman2pacmanpanel" height="90"> <input id="liteman2idpacmancheck" type="checkbox" hidden/> <img style="height: 72px; position: absolute; z-index: 25; top: 0px; left: 0px; cursor:pointer;" id="liteman2impacman2" onclick="liteman1MStart(2)" src="/Scr/pacman/liteman2imagepicman1.png" > </td> <td width="5">|</td> </tr> <tr><td style="vertical-align: middle;" align="center" height="50" colspan="3"> <input id="liteman1butstart" type="button" value="старт" onclick="liteman1MStart(1);" style="background: #0079FF;"> <input id="liteman2butstart" type="button" value="старт" onclick="liteman1MStart(2);" style="background: #FF6900;"> </td></tr> </table> <table width="580" height="40" class="colorborder" align="center" border="1"> <tr> <td style="vertical-align: middle;" align="center" height="20"> <div align="center">ваш выбор</div> </td> <td style="vertical-align: middle;" align="center" height="20"> <div align="center">победитель</div> </td> <td style="vertical-align: middle;" align="center" height="20"> <div align="center">баллы</div> </td> </tr> <tr> <td style="vertical-align: middle;" align="center" height="20"><div align="center" id="liteman1tabletd31"></div></td> <td style="vertical-align: middle;" align="center" height="20"><div align="center" id="liteman1tabletd11"></div></td> <td style="vertical-align: middle;" align="center" height="20"><div align="center" id="liteman1tabletd21"></div></td> </tr> <tr> <td style="vertical-align: middle;" align="center" height="20"><div align="center" id="liteman1tabletd32"></div></td> <td style="vertical-align: middle;" align="center" height="20"><div align="center" id="liteman1tabletd12"></div></td> <td style="vertical-align: middle;" align="center" height="20"><div align="center" id="liteman1tabletd22"></div></td> </tr> <tr> <td style="vertical-align: middle;" align="center" height="20"><div align="center" id="liteman1tabletd33"></div></td> <td style="vertical-align: middle;" align="center" height="20"><div align="center" id="liteman1tabletd13"></div></td> <td style="vertical-align: middle;" align="center" height="20"><div align="center" id="liteman1tabletd23"></div></td> </tr> <tr> <td style="vertical-align: middle;" align="center" height="20"><div align="center" id="liteman1tabletd34"></div></td> <td style="vertical-align: middle;" align="center" height="20"><div align="center" id="liteman1tabletd14"></div></td> <td style="vertical-align: middle;" align="center" height="20"><div align="center" id="liteman1tabletd24"></div></td> </tr> <tr> <td style="vertical-align: middle;" align="center" height="20"><div align="center" id="liteman1tabletd35"></div></td> <td style="vertical-align: middle;" align="center" height="20"><div align="center" id="liteman1tabletd15"></div></td> <td style="vertical-align: middle;" align="center" height="20"><div align="center" id="liteman1tabletd25"></div></td> </tr> </table> <script> var liteman1numstart = 0; var liteman1flagcolor = 0; var liteman1flagstart = false; var liteman1timer1 = 0; var liteman1timer2 = 0; function liteman1getRandomInt(min, max) { return Math.floor(Math.random() * (max - min)) + min; } function liteman1MStart(liteman1num) { if (liteman1flagstart === false) { liteman1flagstart = true; if (liteman1num === 1) document.getElementById('liteman1butstart').value = "стоп"; if (liteman1num === 2) document.getElementById('liteman2butstart').value = "стоп"; liteman1numstart ++; if (liteman1numstart > 5) { liteman1numstart = 1; document.getElementById('liteman1tabletd31').innerHTML= ""; document.getElementById('liteman1tabletd11').innerHTML= ""; document.getElementById('liteman1tabletd21').innerHTML= ""; document.getElementById('liteman1tabletd32').innerHTML= ""; document.getElementById('liteman1tabletd12').innerHTML= ""; document.getElementById('liteman1tabletd22').innerHTML= ""; document.getElementById('liteman1tabletd33').innerHTML= ""; document.getElementById('liteman1tabletd13').innerHTML= ""; document.getElementById('liteman1tabletd23').innerHTML= ""; document.getElementById('liteman1tabletd34').innerHTML= ""; document.getElementById('liteman1tabletd14').innerHTML= ""; document.getElementById('liteman1tabletd24').innerHTML= ""; document.getElementById('liteman1tabletd35').innerHTML= ""; document.getElementById('liteman1tabletd15').innerHTML= ""; document.getElementById('liteman1tabletd25').innerHTML= ""; } if (liteman1num === 1) document.getElementById('liteman1tabletd3' + liteman1numstart).innerHTML= "синий"; if (liteman1num === 2) document.getElementById('liteman1tabletd3' + liteman1numstart).innerHTML= "оранжевый"; document.getElementById('liteman1krug').innerHTML = "первый круг"; liteman1tempLeft = 0; liteman2tempLeft = 0; liteman1timer1 = 0; liteman1timer2 = 0; liteman1pacmanclick(); liteman2pacmanclick(); liteman1flagcolor = liteman1num; } else { liteman1flagstart = false; document.getElementById('liteman1butstart').value = "старт"; document.getElementById('liteman2butstart').value = "старт"; document.getElementById('liteman1krug').innerHTML = "3 круга"; document.getElementById('liteman1idpacmancheck').checked = false; document.getElementById('liteman2idpacmancheck').checked = false; liteman1tempLeft = 0; liteman2tempLeft = 0; liteman1flagcolor = 0; liteman1timer1 = 0; liteman1timer2 = 0; } } </script> <script> var liteman1lenthgo = 500; //add function getOffset(elem) { if (elem.getBoundingClientRect) { return getOffsetRect(elem) } else { return getOffsetSum(elem) } } function getOffsetSum(elem) { var top=0, left=0 while(elem) { top = top + parseInt(elem.offsetTop) left = left + parseInt(elem.offsetLeft) elem = elem.offsetParent } return {top: top, left: left} } function getOffsetRect(elem) { // (1) var box = elem.getBoundingClientRect() // (2) var body = document.body var docElem = document.documentElement // (3) var scrollTop = window.pageYOffset || docElem.scrollTop || body.scrollTop var scrollLeft = window.pageXOffset || docElem.scrollLeft || body.scrollLeft // (4) var clientTop = docElem.clientTop || body.clientTop || 0 var clientLeft = docElem.clientLeft || body.clientLeft || 0 // (5) var top = box.top + scrollTop - clientTop var left = box.left + scrollLeft - clientLeft return { top: Math.round(top), left: Math.round(left) } } //end add var liteman1tempLeft = 3; var liteman1elm = document.getElementById('liteman1pacmanpanel'); var liteman1coords = getOffset(liteman1elm); document.getElementById('liteman1impacman2').style.top = 3 + liteman1coords.top + "px"; document.getElementById('liteman1impacman2').style.left = liteman1tempLeft + liteman1coords.left +"px"; document.getElementById('liteman1impacman2').src='/Scr/pacman/liteman1imagepicman1.png'; var liteman1timer = setInterval(liteman1fStartAnim, 10); var liteman1tempClock = 5000; function liteman1pacmanclick() { liteman1tempClock = 0; document.getElementById('liteman1idpacmancheck').checked = !(document.getElementById('liteman1idpacmancheck').checked); } function liteman1fStartAnim() { var liteman1elm = document.getElementById('liteman1pacmanpanel'); var liteman1coords = getOffset(liteman1elm); document.getElementById('liteman1impacman2').style.top = eval(liteman1coords.top - 0) + "px"; document.getElementById('liteman1impacman2').style.left = document.getElementById('liteman1pacmanpanel').style.left; ///////////////////////////// if (document.getElementById('liteman1idpacmancheck').checked){ liteman1timer1++; var liteman1rndspeed = liteman1getRandomInt(0, 6); liteman1tempClock = liteman1tempClock + liteman1rndspeed; if ((liteman1tempClock > 0)&&(liteman1tempClock <= liteman1lenthgo)) { liteman1tempLeft = liteman1tempLeft + liteman1rndspeed; document.getElementById('liteman1impacman2').style.left = liteman1tempLeft + liteman1coords.left +"px"; document.getElementById('liteman1impacman2').src='/Scr/pacman/liteman1imagepicman1.png'; } if ((liteman1tempClock > liteman1lenthgo)&&(liteman1tempClock <= (2 * liteman1lenthgo))) { liteman1tempLeft = liteman1tempLeft - liteman1rndspeed; document.getElementById('liteman1impacman2').style.left = liteman1tempLeft + liteman1coords.left +"px"; document.getElementById('liteman1impacman2').src='/Scr/pacman/liteman1imagepicman2.png'; } if ((liteman1tempClock > (2 * liteman1lenthgo))&&(liteman1tempClock <= (3 * liteman1lenthgo))) { liteman1tempLeft = liteman1tempLeft + liteman1rndspeed; document.getElementById('liteman1impacman2').style.left = liteman1tempLeft + liteman1coords.left +"px"; document.getElementById('liteman1impacman2').src='/Scr/pacman/liteman1imagepicman1.png'; document.getElementById('liteman1krug').innerHTML = "второй круг"; } if ((liteman1tempClock > (3 * liteman1lenthgo))&&(liteman1tempClock <= (4 * liteman1lenthgo))) { liteman1tempLeft = liteman1tempLeft - liteman1rndspeed; document.getElementById('liteman1impacman2').style.left = liteman1tempLeft + liteman1coords.left +"px"; document.getElementById('liteman1impacman2').src='/Scr/pacman/liteman1imagepicman2.png'; } if ((liteman1tempClock > (4 * liteman1lenthgo))&&(liteman1tempClock <= (5 * liteman1lenthgo))) { liteman1tempLeft = liteman1tempLeft + liteman1rndspeed; document.getElementById('liteman1impacman2').style.left = liteman1tempLeft + liteman1coords.left +"px"; document.getElementById('liteman1impacman2').src='/Scr/pacman/liteman1imagepicman1.png'; document.getElementById('liteman1krug').innerHTML = "третий круг"; } if ((liteman1tempClock > (5 * liteman1lenthgo))&&(liteman1tempClock <= (6 * liteman1lenthgo))) { liteman1tempLeft = liteman1tempLeft - liteman1rndspeed; document.getElementById('liteman1impacman2').style.left = liteman1tempLeft + liteman1coords.left +"px"; document.getElementById('liteman1impacman2').src='/Scr/pacman/liteman1imagepicman2.png'; } if (liteman1tempClock > (6 * liteman1lenthgo)) { liteman1tempLeft = 3; document.getElementById('liteman1impacman2').style.left = liteman1tempLeft + liteman1coords.left +"px"; document.getElementById('liteman1idpacmancheck').checked = false; document.getElementById('liteman1impacman2').src='/Scr/pacman/liteman1imagepicman1.png'; document.getElementById('liteman1tabletd1' + liteman1numstart).innerHTML = "синий"; document.getElementById('liteman1tabletd2' + liteman1numstart).innerHTML = liteman1timer1; liteman1timer1 = 0; liteman1timer2 = 0; liteman1timer3 = 0; liteman1timer4 = 0; liteman1flagcolor=0; liteman1flagstart = false; document.getElementById('liteman1butstart').value = "старт"; document.getElementById('liteman2butstart').value = "старт"; document.getElementById('liteman1krug').innerHTML = "3 круга"; document.getElementById('liteman1idpacmancheck').checked = false; document.getElementById('liteman2idpacmancheck').checked = false; } }} </script> <script> var liteman2lenthgo = 500; var liteman2tempLeft = 3; var liteman2elm = document.getElementById('liteman2pacmanpanel'); var liteman2coords = getOffset(liteman2elm); document.getElementById('liteman2impacman2').style.top = 3 + liteman2coords.top + "px"; document.getElementById('liteman2impacman2').style.left = liteman2tempLeft + liteman2coords.left +"px"; document.getElementById('liteman2impacman2').src='/Scr/pacman/liteman2imagepicman1.png'; var liteman2timer = setInterval(liteman2fStartAnim, 10); var liteman2tempClock = 5000; function liteman2pacmanclick() { liteman2tempClock = 0; document.getElementById('liteman2idpacmancheck').checked = !(document.getElementById('liteman2idpacmancheck').checked); } function liteman2fStartAnim() { var liteman2elm = document.getElementById('liteman2pacmanpanel'); var liteman2coords = getOffset(liteman2elm); document.getElementById('liteman2impacman2').style.top = eval(liteman2coords.top - 0) + "px"; document.getElementById('liteman2impacman2').style.left = document.getElementById('liteman2pacmanpanel').style.left; ///////////////////////////// if (document.getElementById('liteman2idpacmancheck').checked){ liteman1timer2++; var liteman2rndspeed = liteman1getRandomInt(0, 6); liteman2tempClock = liteman2tempClock + liteman2rndspeed; if ((liteman2tempClock > 0)&&(liteman2tempClock <= liteman2lenthgo)) { liteman2tempLeft = liteman2tempLeft + liteman2rndspeed; document.getElementById('liteman2impacman2').style.left = liteman2tempLeft + liteman2coords.left +"px"; document.getElementById('liteman2impacman2').src='/Scr/pacman/liteman2imagepicman1.png'; } if ((liteman2tempClock > liteman2lenthgo)&&(liteman2tempClock <= (2 * liteman2lenthgo))) { liteman2tempLeft = liteman2tempLeft - liteman2rndspeed; document.getElementById('liteman2impacman2').style.left = liteman2tempLeft + liteman2coords.left +"px"; document.getElementById('liteman2impacman2').src='/Scr/pacman/liteman2imagepicman2.png'; } if ((liteman2tempClock > (2 * liteman2lenthgo))&&(liteman2tempClock <= (3 * liteman2lenthgo))) { liteman2tempLeft = liteman2tempLeft + liteman2rndspeed; document.getElementById('liteman2impacman2').style.left = liteman2tempLeft + liteman2coords.left +"px"; document.getElementById('liteman2impacman2').src='/Scr/pacman/liteman2imagepicman1.png'; document.getElementById('liteman1krug').innerHTML = "второй круг"; } if ((liteman2tempClock > (3 * liteman2lenthgo))&&(liteman2tempClock <= (4 * liteman2lenthgo))) { liteman2tempLeft = liteman2tempLeft - liteman2rndspeed; document.getElementById('liteman2impacman2').style.left = liteman2tempLeft + liteman2coords.left +"px"; document.getElementById('liteman2impacman2').src='/Scr/pacman/liteman2imagepicman2.png'; } if ((liteman2tempClock > (4 * liteman2lenthgo))&&(liteman2tempClock <= (5 * liteman2lenthgo))) { liteman2tempLeft = liteman2tempLeft + liteman2rndspeed; document.getElementById('liteman2impacman2').style.left = liteman2tempLeft + liteman2coords.left +"px"; document.getElementById('liteman2impacman2').src='/Scr/pacman/liteman2imagepicman1.png'; document.getElementById('liteman1krug').innerHTML = "третий круг"; } if ((liteman2tempClock > (5 * liteman2lenthgo))&&(liteman2tempClock <= (6 * liteman2lenthgo))) { liteman2tempLeft = liteman2tempLeft - liteman2rndspeed; document.getElementById('liteman2impacman2').style.left = liteman2tempLeft + liteman2coords.left +"px"; document.getElementById('liteman2impacman2').src='/Scr/pacman/liteman2imagepicman2.png'; }if (liteman2tempClock > (6 * liteman2lenthgo)) { liteman2tempLeft = 3; document.getElementById('liteman2impacman2').style.left = liteman2tempLeft + liteman2coords.left +"px"; document.getElementById('liteman2idpacmancheck').checked = false; document.getElementById('liteman2impacman2').src='/Scr/pacman/liteman2imagepicman1.png'; document.getElementById('liteman1tabletd1' + liteman1numstart).innerHTML = "оранжевый"; document.getElementById('liteman1tabletd2' + liteman1numstart).innerHTML = liteman1timer2; liteman1timer1 = 0; liteman1timer2 = 0; liteman1timer3 = 0; liteman1timer4 = 0; liteman1flagcolor=0; liteman1flagstart = false; document.getElementById('liteman1butstart').value = "старт"; document.getElementById('liteman2butstart').value = "старт"; document.getElementById('liteman1krug').innerHTML = "3 круга"; document.getElementById('liteman1idpacmancheck').checked = false; document.getElementById('liteman2idpacmancheck').checked = false; } }} </script>