Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:

лабораторные работы / движение кнопок

.docx
Скачиваний:
25
Добавлен:
28.01.2014
Размер:
75.55 Кб
Скачать

<html>

<head>

<script language="javascript">

function fun(id) {

pic.style.left=parseInt(document.getElementById(id).style.left)+10;

}

function fun1(id) {

pic.style.left=parseInt(document.getElementById(id).style.left)-10;

}

function fun2(id) {

pic.style.top=parseInt(document.getElementById(id).style.top)+10;

}

function fun3(id) {

pic.style.top=parseInt(document.getElementById(id).style.top)-10;

}

</script>

</head>

<body>

<img style="position:relative; left:350px; top:50px" id="pic" src="свин.jpg" width="250" align="center"><br>

<input type="button" value="вправо" style="width: 60px" onclick="fun('pic')">

<input type="button" value="влево" style="width: 60px" onclick="fun1('pic')">

<input type="button" value="вниз" style="width: 60px" onclick="fun2('pic')">

<input type="button" value="вверх" style="width: 60px" onclick="fun3('pic')">

</body>

</html>

Соседние файлы в папке лабораторные работы