gatsu35 Blablaté par Harko | Code :
- <script type="text/javascript">
- document.write("<img src='images/1/" + parseInt(Math.random()*2) + ".png' width='500' usemap="#ayu" height='648' alt='Galerie Ayumi Hamasaki' title='Galerie Ayumi Hamasaki' />" );
- </script>
-
-
- <center><map name="ayu">
- <area shape="rect" coords="224,494,494,527" href="#bio" alt="Biographie Ayumi Hamasaki" title="Biographie">
- <area shape="rect" coords="42,306,188,338" href="#lyrics" alt="Lyrics Ayumi Hamasaki" title="Lyrics">
- <area shape="rect" coords="296,153,470,185" href="#pix" alt="Galerie Ayumi Hamasaki" title="Galerie">
- </map></center>
|
ou encore en un peu plus propre
Code :
- <img id="imgayu" width="500" height="648" border="0" usemap="#ayu" alt="" />
-
- <script type="text/javascript">
- document.getElementById("imgayu" ).src = "images/1/" + parseInt(Math.random()*2) + ".png";
- </script>
- <center><map name="ayu">
- <area shape="rect" coords="224,494,494,527" href="#bio" alt="Biographie Ayumi Hamasaki" title="Biographie">
- <area shape="rect" coords="42,306,188,338" href="#lyrics" alt="Lyrics Ayumi Hamasaki" title="Lyrics">
- <area shape="rect" coords="296,153,470,185" href="#pix" alt="Galerie Ayumi Hamasaki" title="Galerie">
- </map></center>
|
Ou encore mieux, tu me vires tout ce code de merde et tu me le fais en CSS et en JS proprement de cette maniere
Code :
- <ul id="menu">
- <li id="menu_bio"><a href="#bio" title="Biographie Ayumi Hamasaki">Biographie</a></li>
- <li id="menu_lyrics"><a href="#lyrics" title="Lyrics Ayumi Hamasaki">Lyrics</a></li>
- <li id="menu_pix"><a href="#pix" title="Galerie Ayumi Hamasaki">Galerie</a></li>
- </ul>
- <style type="text/css">
- /* la balise style doit soit etre mise dans le header ou bien tu mets le code CSS dans une feuille CSS a part */
- #menu, #menu li {margin:0; padding:0}
- #menu {position:relative; height:648px; width:500px; background:url(images/1/1.png) no-repeat left top}
- #menu li {position:absolute;}
- #menu li a {display:block; overflow:hidden; height:100%; text-indent:-5000px; font-size:5000px; letter-spacing:5001px} /*a cause de IE le A ne serait pas forcément correctement pris en compte */
- #menu_bio {left:224px; top:494px; width:275px; height:33px}
- #menu_bio {left:42px; top:306px; width:146px; height:32px}
- #menu_bio {left:296px; top:153px; width:174px; height:32px}
- </style>
- <script type="text/javascript">
- // code JS qui peut etre mis dans un fichier JS à part
- function addEvent( obj, type, fn )
- {
- if (obj.addEventListener)
- obj.addEventListener( type, fn, false );
- else if (obj.attachEvent)
- {
- obj["e"+type+fn] = fn;
- obj[type+fn] = function() { obj["e"+type+fn]( window.event ); }
- obj.attachEvent( "on"+type, obj[type+fn] );
- }
- }
- function randomNavImage() {
- var m = document.getElementById("menu" );
- if (m) m.style.backgroundImage = "url(images/1/" + parseInt(Math.random()*2) + ".png)";
- }
- addEvent(window, "load", randomNavImage);
- </script>
| Edit : Ayumi Message édité par gatsu35 le 22-04-2007 à 23:18:25
|