Показать сообщение отдельно
  #1 (permalink)  
Старый 06.11.2009, 07:50
Профессор
Отправить личное сообщение для Andrei Посмотреть профиль Найти все сообщения от Andrei
 
Регистрация: 31.10.2009
Сообщений: 151

Передача переменной !
Здравствуйте !
Неполучается передать i функции screen_win !

function init() {

for (var i = 1; i < 5; i++) {
document.getElementById("but_"+i).onmouseover = function(){ screen_win(i)};
document.getElementById("but_"+i).onmouseout = function () { off()};
}

}


function screen_win(but) {
alert (but); //Здесь выводит пять при наведении на любую из кнопок !
if (but== 1) {

document.getElementById('screen_win').style.left = "3px"

document.getElementById('screen_img').src = "1.jpeg";

} else if (but == 2) {

document.getElementById('screen_win').style.left = "68px"

document.getElementById('screen_img').src = "2.jpeg";

} else if (but == 3) {

document.getElementById('screen_win').style.left = "150px"

document.getElementById('screen_img').src = "1.jpeg";

} else if (but == 4) {

document.getElementById('screen_win').style.left = "220px"

document.getElementById('screen_img').src = "2.jpeg";

}

}
Ответить с цитированием