Модераторы: Sardar, Aliance
  

Поиск:

Ответ в темуСоздание новой темы Создание опроса
> Как заполнить вторую карту map? Тренажер по тренировке интуиции.  
:(
    Опции темы
vladd
Дата 15.11.2016, 15:11 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Шустрый
*


Профиль
Группа: Участник
Сообщений: 134
Регистрация: 31.1.2009

Репутация: нет
Всего: нет



Есть готовый тренажёр для тренировки интуиции на базе Мгновенной лотереи. Хочу дополнить его, соответственно курсу по развитию интуиции, второй картой (map) и линейкой checkbox, для улучшения тренировки. Но в программировании почти ноль. Прошу помочь в этом, для кого это представляет интерес. Могу поделиться ссылкой на сам курс и опытом тренировки. Результат по усилению интуиции гарантированно сразу после первой недели занятий. 
Имеется такая страница http://fs5.directupload.net/images/161115/wjkcxnjl.jpg
Надо получить такую http://fs5.directupload.net/images/161115/uwe8xz4r.jpg
Код


<!-- saved from url=(0031)http://antimagiya.ru/lottos.php -->
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><script src="./lottos.php_files/jquery.min.js"></script>
<script type="text/javascript" src="./lottos.php_files/trenirovka.js"></script>
<script type="text/javascript" src="./lottos.php_files/tt.js"></script>

</head>
<body style="COLOR: #000000; FONT-FAMILY: 'Arial'; margin-top:100; margin-left:50">

<map name="image_map">
<area onclick="ClickField(100)" shape="RECT" coords="245,89,285,118">
<area onclick="ClickField(101)" shape="RECT" coords="245,129,285,158">
<area onclick="ClickField(102)" shape="RECT" coords="245,169,285,198">
<area onclick="ClickField(103)" shape="RECT" coords="245,209,285,238">
<area onclick="ClickField(104)" shape="RECT" coords="245,249,285,278">
<area onclick="ClickField(105)" shape="RECT" coords="245,289,285,318">

<area onclick="ClickField(106)" shape="RECT" coords="245,329,285,358">

<area onclick="ClickField(107)" shape="RECT" coords="245,369,285,398">
<area onclick="ClickField(108)" shape="RECT" coords="245,409,285,438">

<area onclick="ClickField(109)" shape="RECT" coords="292,89,332,118">
<area onclick="ClickField(110)" shape="RECT" coords="292,129,332,158">
<area onclick="ClickField(111)" shape="RECT" coords="292,169,332,198">
<area onclick="ClickField(112)" shape="RECT" coords="292,209,332,238">
<area onclick="ClickField(113)" shape="RECT" coords="292,249,332,278">
<area onclick="ClickField(114)" shape="RECT" coords="292,289,332,318">
<area onclick="ClickField(115)" shape="RECT" coords="292,329,332,358">
<area onclick="ClickField(116)" shape="RECT" coords="292,369,332,398">
<area onclick="ClickField(117)" shape="RECT" coords="292,409,332,438">
</map>

<div id="Field100" style="position: absolute; z-index: 10; left: 265px; top: 256px; "></div>
<div id="Field101" style="position: absolute; z-index: 10; left: 265px; top: 296px;"></div>

<div id="Field102" style="position: absolute; z-index: 10; left: 265px; top: 336px;"></div>
<div id="Field103" style="position: absolute; z-index: 10; left: 265px; top: 376px;"></div>
<div id="Field104" style="position: absolute; z-index: 10; left: 265px; top: 416px;"></div>
<div id="Field105" style="position: absolute; z-index: 10; left: 265px; top: 456px;"></div>
<div id="Field106" style="position: absolute; z-index: 10; left: 265px; top: 496px;"></div>
<div id="Field107" style="position: absolute; z-index: 10; left: 265px; top: 536px;"></div>
<div id="Field108" style="position: absolute; z-index: 10; left: 265px; top: 576px;"></div>
<div id="Field109" style="position: absolute; z-index: 10; left: 312px; top: 256px;"></div>
<div id="Field110" style="position: absolute; z-index: 10; left: 312px; top: 296px;"></div>
<div id="Field111" style="position: absolute; z-index: 10; left: 312px; top: 336px;"></div>
<div id="Field112" style="position: absolute; z-index: 10; left: 312px; top: 376px;"></div>
<div id="Field113" style="position: absolute; z-index: 10; left: 312px; top: 416px;"></div>
<div id="Field114" style="position: absolute; z-index: 10; left: 312px; top: 456px;"></div>
<div id="Field115" style="position: absolute; z-index: 10; left: 312px; top: 496px;"></div>
<div id="Field116" style="position: absolute; z-index: 10; left: 312px; top: 536px;"></div>
<div id="Field117" style="position: absolute; z-index: 10; left: 312px; top: 576px;"></div>

<map name="image_map1">
<area  shape="RECT" coords="245,89,285,118">
<area  shape="RECT" coords="245,129,285,158">
<area  shape="RECT" coords="245,169,285,198">
<area  shape="RECT" coords="245,209,285,238">
<area  shape="RECT" coords="245,249,285,278">
<area  shape="RECT" coords="245,289,285,318">

<area  shape="RECT" coords="245,329,285,358">

<area  shape="RECT" coords="245,369,285,398">
<area  shape="RECT" coords="245,409,285,438">

<area  shape="RECT" coords="292,89,332,118">
<area  shape="RECT" coords="292,129,332,158">
<area  shape="RECT" coords="292,169,332,198">
<area  shape="RECT" coords="292,209,332,238">
<area  shape="RECT" coords="292,249,332,278">
<area  shape="RECT" coords="292,289,332,318">
<area  shape="RECT" coords="292,329,332,358">
<area  shape="RECT" coords="292,369,332,398">
<area  shape="RECT" coords="292,409,332,438">
</map>

<div id="Field200" style="position: absolute; z-index: 10; left: 265px; top: 256px;"></div>
<div id="Field201" style="position: absolute; z-index: 10; left: 265px; top: 296px;"></div>

<div id="Field202" style="position: absolute; z-index: 10; left: 265px; top: 336px;"></div>
<div id="Field203" style="position: absolute; z-index: 10; left: 265px; top: 376px;"></div>
<div id="Field204" style="position: absolute; z-index: 10; left: 265px; top: 416px;"></div>
<div id="Field205" style="position: absolute; z-index: 10; left: 265px; top: 456px;"></div>
<div id="Field206" style="position: absolute; z-index: 10; left: 265px; top: 496px;"></div>
<div id="Field207" style="position: absolute; z-index: 10; left: 265px; top: 536px;"></div>
<div id="Field208" style="position: absolute; z-index: 10; left: 265px; top: 576px;"></div>
<div id="Field209" style="position: absolute; z-index: 10; left: 312px; top: 256px;"></div>
<div id="Field210" style="position: absolute; z-index: 10; left: 312px; top: 296px;"></div>
<div id="Field211" style="position: absolute; z-index: 10; left: 312px; top: 336px;"></div>
<div id="Field212" style="position: absolute; z-index: 10; left: 312px; top: 376px;"></div>
<div id="Field213" style="position: absolute; z-index: 10; left: 312px; top: 416px;"></div>
<div id="Field214" style="position: absolute; z-index: 10; left: 312px; top: 456px;"></div>
<div id="Field215" style="position: absolute; z-index: 10; left: 312px; top: 496px;"></div>
<div id="Field216" style="position: absolute; z-index: 10; left: 312px; top: 536px;"></div>
<div id="Field217" style="position: absolute; z-index: 10; left: 312px; top: 576px;"></div>
<table width="50%" border="1" cellpadding="0" cellspacing="0" id="MainTab" valign="top">
  <tbody><tr>
    <td colspan="2"><img src="./lottos.php_files/bilet.jpg" name="Back" border="0" usemap="#image_map" id="Bilet" style="z-index:0">
    </td>
<td>
  <img src="./lottos.php_files/Prise.jpg" name="Back" border="0" usemap="#image_map1" id="Prise" style="z-index:0">
</td>
<td width=40px valign="top">
  <label style="position: relative; left: 2px; top: 90px;"><span>9</span><input type="checkbox" name="a9"  vspace="4"></label>
  <label style="position: relative; left: 2px; top: 111px;"><span>8</span><input type="checkbox" name="a8"></label>
  <label style="position: relative; left: 2px; top: 132px;"><span>7</span><input type="checkbox" name="a7"></label>
  <label style="position: relative; left: 2px; top: 153px;"><span>6</span><input type="checkbox" name="a6"></label>
  <label style="position: relative; left: 2px; top: 174px;"><span>5</span><input type="checkbox" name="a5"></label> 
  <label style="position: relative; left: 2px; top: 195px;"><span>4</span><input type="checkbox" name="a4" ></label>
  <label style="position: relative; left: 2px; top: 216px;"><span>3</span><input type="checkbox" name="a3"></label> 
  <label style="position: relative; left: 2px; top: 237px;"><span>2</span><input type="checkbox" name="a2"></label> 
  <label style="position: relative; left: 2px; top: 258px;"><span>1</span><input type="checkbox" name="a1"></label>
</td>
  </tr>
  <tr height="30">
    <td width="130" style="padding-top:10">
    <img src="./lottos.php_files/butnew.gif" name="ButNew" onclick="NewLot()" onmouseover="document.all['ButNew'].src='http://antimagiya.ru/imagus/butnew_over.gif'" ;="" onmouseout="document.all['ButNew'].src='http://antimagiya.ru/imagus/butnew.gif'">
    </td>

    <td style="padding-top:10"><img src="./lottos.php_files/butend.gif" name="ButEnd" onclick="EndGame(1)" onmouseover="document.all['ButEnd'].src='http://antimagiya.ru/imagus/butend_over.gif'" ;="" onmouseout="document.all['ButEnd'].src='http://antimagiya.ru/imagus/butend.gif'">
    </td>
</tr></tbody></table>

</body></html>

Код

//Параметры лотереи
var Lot=new Object();
Lot.lottery_type = 'housenew';
//Lot.tablstat='gamestat_housenew'; //таблица в БД
Lot.lot=3; //Лотерея МУ-МУ
Lot.games=1; //кол-во игр в лотерее
Lot.id_game;

//Параметры игры
var Game=new Array();

/*
var cond=0; //состояние игры: 0 - не начата, 1 - начата, 2 - закончена
var Fields; //массив значений полей
var Open; //массив признаков открытых полей
var count_open; //кол-во открытых окон всего
var count_right; //кол-во правильно открытых окон
var count_wrong; //кол-во неправильно открытых окон
var komb=''; //комбинация
var choice=''; //выбранные поля
var date_beg; //время начала
var date_end; //время конца
var WinCost; //массив сообщений о выигрыше
*/

//
var pos_left;
var pos_top;
var loaded=0;

//------------------------------------------------------
function onLoad()
{
Init();
for(g=1; g<=Lot.games; g++) InitGame(g);
loaded=1;
NewLot();
}
//------------------------------------------------------
function onUnload()
{
CloseLot();
}
//------------------------------------------------------
function Init()
{
pos_left=document.all["MainTab"].offsetLeft;
pos_top=document.all["MainTab"].offsetTop;

//document.all["ButNew"].style.left=pos_left+document.all["Bilet"].clientWidth+30;
//document.all["ButEnd"].style.left=pos_left+document.all["Bilet"].clientWidth+30;
//document.all["ButNew"].style.top=pos_top+445;
//document.all["ButEnd"].style.top=pos_top+485;
}
//------------------------------------------------------
function CloseLot()
{
//отправка результата если игра была не закончена
for(g=1; g<=Lot.games; g++)
{
if(Game[g].cond==1)
    {Game[g].date_end=new Date();
    SendResult(g,Game[g].date_beg,Game[g].date_end,Game[g].komb,Game[g].choice,Game[g].cond,Game[g].count_open);
    }
Game[g].cond=2;
}

}
//------------------------------------------------------
function NewLot()
{
if(loaded==0) return;
CloseLot();
//берется начальное ID
Lot.id_game=GetID();
//alert(Lot.id_game);
//Lot.id_game=document.all['id_first'].innerHTML;
for(g=1; g<=Lot.games; g++) ResetGame(g);
}
//------------------------------------------------------

function GetID()
{
return Math.floor(Math.random()*4000000000);
}
//------------------------------------------------------
//Задание начальных значений игры
function InitGame(g)
{
Game[g]=new Object();
Game[g].cond=0;

switch(g)
{case 1:
Game[g].Win=new Array();
Game[g].Win[1]="Выигрыш 50 рублей!"; Game[g].Win[2]="Выигрыш 100 рублей!";
Game[g].Win[3]="Выигрыш 150 рублей!"; Game[g].Win[4]="Выигрыш 300 рублей!";
Game[g].Win[5]="Выигрыш 500 рублей!"; Game[g].Win[6]="Выигрыш 1000 рублей!";
Game[g].Win[7]="Выигрыш 2000 рублей!"; Game[g].Win[8]="Выигрыш 5000 рублей!";
Game[g].Win[9]="Выигрыш 10000 рублей!";

Game[g].Summ=new Array();
Game[g].Summ[1]=50; Game[g].Summ[2]=100;
Game[g].Summ[3]=150; Game[g].Summ[4]=300;
Game[g].Summ[5]=500; Game[g].Summ[6]=1000;
Game[g].Summ[7]=2000; Game[g].Summ[8]=5000;
Game[g].Summ[9]=10000;

for(i=-1; i>=-9; i--) Game[g].Win[i]="Проигрыш.";

} //switch

}
//------------------------------------------------------
//Сброс игры в начальное состояние
function ResetGame(g)
{
Game[g].cond=0;
Game[g].count_open=0;
Game[g].count_right=0;
Game[g].count_wrong=0;
Game[g].komb='';
Game[g].choice='';
Game[g].Open=new Array();

//
switch(g)
{case 1:
for(f=0; f<18; f++) Game[g].Open[f]=false;

Game[g].Fields=new Array();
for(f=0; f<18; f++)    document.all["Field"+g+(f<10?'0'+f:f)].innerHTML="";

for(f=1; f<=9; f++)
    {
    w=Game[g].Summ[f];

    if(Math.random()<0.5)
        {Game[g].Fields[9-f]=w;
        Game[g].Fields[9-f+9]=w+Math.floor(Math.random()*w/2)+5;
        }
    else
        {Game[g].Fields[9-f+9]=w;
        Game[g].Fields[9-f]=w+Math.floor(Math.random()*w/2)+5;
        }
    }
} //switch

}
//------------------------------------------------------
function ClickField(i)
{
if(loaded==0) onLoad();
if(Lot.id_game==0) return;

g=Math.floor(i/100);
f=i-100*g; //номер поля

if(Game[g].cond==2) return;
if(Game[g].Open[f]==true) return;

if(Game[g].cond==0 && Game[g].count_open==0) Game[g].date_beg=new Date();
if(Game[g].cond==0 && Game[g].count_open==0) Game[g].cond=1;

//s='<table width="52"  style="font-size:16px; color:#000000; text-align:center; font-weight:bold" height="37" border="0" cellpadding="0" cellspacing="0"><tr><td></td></tr></table>';

switch(g)
{case 1:
co=9-(f-Math.floor(f/9)*9);
if(co!=Game[g].count_open+1) return;
Game[g].Open[f]=true;
Game[g].count_open+=1;

ShowField(g,f);

if(Game[g].Fields[f]!=Game[g].Summ[co]) WinGame(g,-1);
if(Game[g].Fields[f]==Game[g].Summ[co] && Game[g].count_open==9) WinGame(g,Game[g].count_open);

} //switch

}
//------------------------------------------------------
function ShowField(g,f)
{
i=g*100+f;

if(f<9)
    {document.all["Field"+i].style.left=pos_left+245;
    document.all["Field"+i].style.top=pos_top+89+f*40;
    }
else
    {document.all["Field"+i].style.left=pos_left+292;
    document.all["Field"+i].style.top=pos_top+89+(f-9)*40;
    }
// background="Images/b.gif"
s='<table width="40" height="29" bgcolor="#D9D8DE" style="font-size:13px; color:#000000; text-align:center; font-weight:bold; z-index:10" border="0" cellpadding="0" cellspacing="0"><tr><td>'+Game[g].Fields[f]+'</td></tr></table>';
document.all["Field"+i].innerHTML=s;
}
//------------------------------------------------------
function EndGame(g)
{
if(loaded==0) return;
if(Lot.id_game==0) return;
if(Game[g].cond==2 || Game[g].cond==0 || Game[g].count_open==0) return;


switch(g)
{case 1:
WinGame(g,Game[g].count_open);
} //switch

}
function SendResult2(all_answer,сor_answer){
$.ajax({
  type: "POST",
  url: "lotos_ajax.php",
  data: "all="+all_answer+"&cor="+сor_answer+"",
});

}
//------------------------------------------------------
function WinGame(g,win,mess)
{
Game[g].cond=2;
Game[g].date_end=new Date();
Game[g].win=win;
var сor_answer = Game[g].count_open;
var all_answer = Game[g].count_open;
if(win == -1){
cor_answer = сor_answer--;
}
SendResult2(all_answer,сor_answer);
switch(g)
{case 1:
if(mess=='') mess=Game[g].Win[win];
if(confirm(Game[g].Win[win]+"\nОткрыть все окна?"))
    {for(f=0; f<18; f++)
    if(Game[g].Open[f]==false) ShowField(g,f);
    }
} //switch

}
//------------------------------------------------------
function SendResult(game,date_beg,date_end,komb,choice,cond,win) //игра, вариант, начало, конец, комбинация, выбор, признак что закончена
{
//html
}
//------------------------------------------------------
function DateStr(date)
{
//alert(date);
year=date.getYear();
if(year<1900) year+=1900;
month=date.getMonth()+1;
day=date.getDate();
hour=date.getHours();
minut=date.getMinutes();
sec=date.getSeconds();
//alert(year+'-'+month+'-'+day+' '+hour+':'+minut+':'+sec);
return ''+year+'-'+month+'-'+day+' '+hour+':'+minut+':'+sec;
}



Необходимо заполнять вторую карту теми же данными как и в первой карте.
Где выделен checkbox на той линии  надо открыть ячейки во второй карте.
PM MAIL   Вверх
vladd
Дата 15.11.2016, 15:53 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Шустрый
*


Профиль
Группа: Участник
Сообщений: 134
Регистрация: 31.1.2009

Репутация: нет
Всего: нет



Я считаю что заполнение первой карты происходит с 134 строки по 146

Код

for(f=1; f<=9; f++)
    {
    w=Game[g].Summ[f];

    if(Math.random()<0.5)
        {Game[g].Fields[9-f]=w;
        Game[g].Fields[9-f+9]=w+Math.floor(Math.random()*w/2)+5;
        }
    else
        {Game[g].Fields[9-f+9]=w;
        Game[g].Fields[9-f]=w+Math.floor(Math.random()*w/2)+5;
        }
    }
} //switch

Но как сюда прилепить вторую карту не могу понять?
моментальная лотерея

Это сообщение отредактировал(а) vladd - 15.11.2016, 16:48
PM MAIL   Вверх
vladd
Дата 17.11.2016, 17:13 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Шустрый
*


Профиль
Группа: Участник
Сообщений: 134
Регистрация: 31.1.2009

Репутация: нет
Всего: нет



Для заполнения второй карты дубликата первой написал такую функцию
Код

function OpenMap2()
{
    for(f=0; f<18; f++)
{
t = 200+f;
if(f<9)
    {document.all["Field"+t].style.left=pos_left+445;
    document.all["Field"+t].style.top=pos_top+91+f*40;
    }
else
    {document.all["Field"+t].style.left=pos_left+494;
    document.all["Field"+t].style.top=pos_top+91+(f-9)*40;
    }
s='<table width="40" height="29" bgcolor="#D9D8DE" style="font-size:13px; color:#000000; text-align:center; font-weight:bold; z-index:10" border="0" cellpadding="0" cellspacing="0"><tr><td>'+Game[g].Field[f]+'</td></tr></table>';
document.all["Field"+t].innerHTML=s;
}

Но браузер ругается в 14 строке на
Код

Game[g].Field[f]

Как можно это исправить? Помогите.

Это сообщение отредактировал(а) vladd - 17.11.2016, 17:15
PM MAIL   Вверх
vladd
Дата 18.11.2016, 19:50 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Шустрый
*


Профиль
Группа: Участник
Сообщений: 134
Регистрация: 31.1.2009

Репутация: нет
Всего: нет



При загрузке страницы возникает ошибка 
ошибка
Помогите кто может. Буду очень благодарен.
PM MAIL   Вверх
  
Ответ в темуСоздание новой темы Создание опроса
1 Пользователей читают эту тему (1 Гостей и 0 Скрытых Пользователей)
0 Пользователей:
« Предыдущая тема | JavaScript: для новичков | Следующая тема »


 




[ Время генерации скрипта: 0.0916 ]   [ Использовано запросов: 21 ]   [ GZIP включён ]


Реклама на сайте     Информационное спонсорство

 
По вопросам размещения рекламы пишите на vladimir(sobaka)vingrad.ru
Отказ от ответственности     Powered by Invision Power Board(R) 1.3 © 2003  IPS, Inc.