Jump to content
  • 0

смена фона страницы по наведению на ссылку


nick1403
 Share

Question

Товарищи, нужна помощь!

Не подскажите как при наведении на ссылку, в данном случае на кнопку меню менялся фон страницы?

код прилагается :

<html >

<head>

<meta http-equiv="Content-Type" content="text/html; charset=windows-1251" />

<link rel="stylesheet" type="text/css" href="css/reset.css" media="screen" />

<link rel="stylesheet" type="text/css" href="css/style.css" media="screen" />

<style type="text/css">

#container {

width:960px;

margin-left: auto;

margin-right: auto;

padding: 0;

}

.clear {

clear: both;

margin: 0;

padding: 0;

}

p {

margin: 1.6em 0;

line-height: 1.6em;

}

h2 {

font-size: 20px;

line-height: 20px;

margin: 22px 0 18px 0;

}

</style>

</head>

<body background="картинка1.png">

<div id="menu_div">

<div id="navigation">

<div id="menu">

<ul id="nav">

<li><a href="#" onmouseover="body background="картинка2.png">Главная</a>

<ul>

<li><a href="#">Пункт 1 </a></li>

<li><a href="#">Пункт 2</a></li>

<li><a href="#">Пункт 3</a></li>

<li><a href="#">Пункт 4</a></li>

<li><a href="#">Пункт 5</a></li>

<li><a href="#">Пункт 6</a>

<ul>

<li><a href="#">Пункт 1</a></li>

<li><a href="#">Пункт 2</a></li>

<li><a href="#">Пункт 3</a>

<ul>

<li><a href="#">Пункт 1</a></li>

<li><a href="#">Пункт 2</a></li>

<li><a href="#">Пункт 3</a>

<ul>

<li><a href="#">Пункт 1</a></li>

<li><a href="#">Пункт 2</a></li>

<li><a href="#">Пункт 3</a></li>

</ul>

</li>

</ul>

</li>

</ul>

</li>

</ul>

</li>

<li><a href="#">Печи</a>

<ul>

<li><a href="#">Сайты</a></li>

<li><a href="#">Скрипты</a></li>

<li><a href="#">Дизайн</a></li>

<li><a href="#">СЕО</a></li>

<li><a href="#">CMS</a>>

</li>

</ul>

</li>

<li><a href="#">Дымоходы</a>

<ul>

<li><a href="#">Пункт 1</a></li>

<li><a href="#">Пункт 2</a></li>

<li><a href="#">Пункт 3</a></li>

<li><a href="#">Пункт 4</a></li>

</ul>

</li>

<li><a href="#">Баки для бани</a></li>

<li><a href="#">Термозащита</a></li>

</ul>

<form class="searchform" action="#">

<input class="searchfield" type="text" value="Поиск..." onfocus="if (this.value == 'Поиск...') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Поиск...';}" />

</form>

</div>

</div>

</div>

</body>

</html>

что неправильно делаю?

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0
что неправильно делаю?
<body background="картинка1.png">
<a href="#" onmouseover="body background=" картинка2.png"="">Главная

:wacko:

Через Javascript это делается так:


<script type="text/javascript">
window.onload = function() {
document.getElementById('change-background').onmouseover = function(){
document.body.style.background = 'url(...)';
}
}
</script>

И не забыть ссылке прикрутить id(в примере это change-background).

Edited by Vulner
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. See more about our Guidelines and Privacy Policy