> Tous les forumsForum des Webmasters

 JS affichage aléatoire d'une image dans un tableau
Statut du sujet : NON RESOLU Imprimer
 spikelvampiro
  Posté le 28/01/2007 @ 15:04  
 Petit astucien

11 Messages

Bonjour,

J'ai un problème sur ma page htm...

Elle est composée en tableaux, avec dans le tableau du haut mon logo au centre. je souhaite aussi afficher une image de chak coté du logo, 1 à droite et 1 a goche de manière aléatoire (mais toujours 1 de chak coté).

Mon problème est que ces images s'affichent de manière aléatoire comme je le souhaite, mais pas au bon endroit...

voici mon code... je pense que le problème se situe au niveau du script, mais je ne saurais pas dire où exactement. je l'ai fait ressortie en gras pour utilité.

est-ce que quelqu'un pourrait me dire ce qui ne va pas ? Merci beaucoup d'avance

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>index</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
.body {
font-size: 18px;
font-style: normal;
line-height: normal;
font-weight: normal;
font-variant: normal;
color: #FFFFFF;
text-decoration: none;
font-family: Tahoma;
}
.logo {
background-image: url(logo.png);
background-repeat: no-repeat;
background-position: center center;
}
.menu {
font-family: "Blade 2", Evanescent, Neverwinter, QUAKE, Regular;
font-size: 36px;
font-variant: small-caps;
color: #CCCCCC;
text-decoration: none;
}
.bannière {
background-image: url(banniere.png);
background-repeat: no-repeat;
background-position: center center;
}
.cadre {
border: medium solid #FFFFFF;
color: #CCCCCC;
font-family: "Times New Roman", Times, serif;
font-size: 16px;
text-decoration: none;
background-image: url(cadrecopie.png);
background-repeat: repeat-y;
background-position: center top;
}
.cadregauche {
background-image: url(cadre%20gauche.png);
background-repeat: repeat-y;
background-position: right top;
}
.cadredroite {
background-image: url(cadre%20droite.png);
background-repeat: repeat-y;
background-position: left top;
}
-->
</style>
<script language="javascript">
{
document.write('<img src="vincent/'+ Math.round((Math.random()*3)+1)+ '.png" />');
document.write('<img src="chalamon/'+ Math.round((Math.random()*3)+1)+ '.png" />');
}
</script>

</head>

<body background="fondbis.jpg">
<table width="100%" height="210" border="0" cellpadding="0" cellspacing="0" class="banni&egrave;re">
<tr>
<td colspan="2">&nbsp;</td>
<td width="21%" rowspan="3"><div align="center"><img src="logo.png" width="249" height="183"></div></td>
<td width="39%" colspan="2">&nbsp;</td>
</tr>
<tr>
<td height="82" colspan="2"><div align="center"></div></td>
<td colspan="2"><div align="center"></div></td>
</tr>
<tr>
<td colspan="2"><div align="right"><img src="vincent/'+ Math.round((Math.random()*3)+1)+ '.png" width="364" height="74"></div></td>
<td colspan="2"><div align="left"><img src="chalamon/'+ Math.round((Math.random()*3)+1)+ '.png" width="392" height="74"></div></td>

</tr>
</table>
<table width="100%" height="20" border="0" cellpadding="0" cellspacing="0">
<tr class="menu">
<td width="20%"><div align="center"><a href="index.htm">ACCUEIL</a></div></td>
<td width="20%"><div align="center"><a href="codeserecom.htm">SERECOM</a></div></td>
<td width="20%"><div align="center"><a href="codeprive.htm">PRIVE</a></div></td>
<td width="20%"><div align="center"><a href="loisirs.htm">LOISIRS</a></div></td>
<td width="20%"><div align="center"><a href="legal.htm">LEGAL</a></div></td>
</tr>
</table>
<p>&nbsp;</p>
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="body">
<tr>
<td width="21%" class="cadregauche"><div align="right"></div></td>
<td width="58%" class="cadre"><p align="center">Bonjour,</p>
<p align="center">Bienvenue sur mon site perso : celui-ci est maintenant op&eacute;rationnel !!!</p>
<p align="center">Vous trouverez ici mes cours de l'IUT S&eacute;R&eacute;Com (page cod&eacute;e) ainsi que divers fichiers de ma vie priv&eacute;e (page cod&eacute;e aussi... eh eh eh, soyez pas deg !!!).</p>
<p align="center">Quelques articles portant sur diff&eacute;rents loisirs (musique, films, s&eacute;ries, mangas, jeux vid&eacute;os...) se trouvent dans la partie &quot;Loisirs&quot; du site, et j'esp&egrave;re que beaucoup d'entre vous me proposeront leurs articles ou d&eacute;poseront leurs opinions.</p></td>
<td width="21%" class="cadredroite"><div align="left"></div></td>
</tr>
</table>
</body>
</html>

 Afficher le profil de spikelvampiroEnvoyer un message privé à spikelvampiro
 
Haut de la page 
Inscrivez-vous !
- Posez vos questions

- Résolvez vos problèmes

- Aidez les autres

- Participez et créez vos discussions

- Dialoguez en privé avec d'autres membres

- Suivez vos sujets préférés

- Affichez les signatures des membres

TOUT EST GRATUIT !

Je crée mon compte



Vous avez besoin d'aide ?
Des centaines d'experts sont à votre disposition sur les forums PC Astuces pour vous aider gratuitement, 24h/24, 7j/7.

Les derniers sujets résolus !
 

 > Tous les forumsForum des Webmasters

 
Forum PC Astuces© 1997-2008 WebastucesAller en haut de la page