Appel d'une page CSS

Résolu
audric2121 Messages postés 11 Date d'inscription   Statut Membre Dernière intervention   -  
pyschopathe Messages postés 1974 Date d'inscription   Statut Membre Dernière intervention   -
Bonjour,
Je n'arrive pas à faire appel à une page CSS.
Je vous explique ;)

Je dispose d'un fichier menu_droit.js qui contient le code suivant :

<script language="javascript">
<td style="background-color: rgb(0, 58, 107); width: 350px;">
<div style="text-align: center;">
<script language="javascript">
// PLF - https://twitter.com/ceosammassey
var datedujour, date, mois, mois1, jour, jour1, an;
datedujour = new Date();
jour = datedujour.getDay()
switch(jour){
case 1 :
jour1 ="Lundi"
break;
case 2 :
jour1 ="Mardi"
break;
case 3 :
jour1 ="Mercredi"
break;
case 4 :
jour1 ="Jeudi"
break;
case 5 :
jour1 ="Vendredi"
break;
case 6 :
jour1 ="Samedi"
break;
case 0 :
jour1 ="Dimanche"
break;
}
date = datedujour.getDate()
mois = datedujour.getMonth()
switch(mois+1){
case 1 :
mois1 ="Janvier"
break;
case 2 :
mois1 ="Février"
break;
case 3 :
mois1 ="Mars"
break;
case 4 :
mois1 ="Avril"
break;
case 5 :
mois1 ="Mai"
break;
case 6 :
mois1 ="Juin"
break;
case 7 :
mois1 ="Juillet"
break;
case 8 :
mois1 ="Août"
break;
case 9 :
mois1 ="Septembre"
break;
case 10 :
mois1 ="Octobre"
break;
case 11 :
mois1 ="Novembre"
break;
case 12 :
mois1 ="Décembre"
break;
}
an = datedujour.getFullYear()
document.write("<div align='center'><font size='2px'><b>");
document.write(jour1, " ");
document.write(date, " ");
document.write(mois1 , " ");
document.write(an, " ");
document.write("</b></font></div>");
</script></div>
<br>
<div style="text-align: center;">
<table
style="width: 95%; text-align: left; margin-left: auto; margin-right: auto;"
border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td style="text-align: center;">
<table
style="width: 100%; text-align: left; margin-left: auto; margin-right: auto;"
border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td class="stylejsr"
style="color: rgb(255, 255, 255); height: 20px; text-align: center; background-color: rgb(0, 0, 0); width: 160px;"><big>Prochain
match</big></td>
<td class="stylejsr"
style="width: 2px; color: rgb(255, 255, 255);"></td>
<td class="stylejsr"
style="background-color: rgb(0, 0, 0); color: rgb(255, 255, 255); text-align: center;"><big>Dernier
match</big></td>
</tr>
<tr>
<td class="contenu"><img
style="width: 160px; height: 140px;" alt=""
src="http://www.usophain.com/essais/menu2/kitgraphique/fond_prochain.png"></td>
<td></td>
<td class="contenu"> </td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<br>
<table
style="width: 95%; text-align: left; margin-left: auto; margin-right: auto;"
border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td style="text-align: center;">
<script language="JavaScript">
function changeOnglet(Num,MyColor)
{
for (i=1; i<5; i++)
{
if (i!=Num){ document.getElementById('Ong'+i).style.display='none';
document.getElementById('Lang'+i).className='OnBack';
}
else { document.getElementById('Ong'+i).style.display='';
document.getElementById('Lang'+i).className='OnFront';
//document.getElementById('Ong'+i).style.borderBottomColor=MyColor;
} }
}
</script>
<div align="center">
<center>
<table cellpadding="0" cellspacing="0" height="160" width="310">
<tbody>
<tr>
<td style="background-color: rgb(0, 0, 0);" class="OnFront"
id="Lang1" onclick="changeOnglet(1,this.style.backgroundColor);"
height="23" width="25%"> <span style="color: rgb(255, 255, 255);">
Classement </span></td>
<td
style="border-right: 1px solid rgb(0, 0, 0); background-color: rgb(255, 255, 255); color: rgb(0, 0, 0);"
class="OnBack" id="Lang2"
onclick="changeOnglet(2,this.style.backgroundColor);" height="23"
width="25%"> Buteurs<span style="color: rgb(255, 255, 255);"> </span></td>
</tr>
<tr style="color: rgb(255, 255, 255);">
<td colspan="4" class="Tab" height="160" width="310">
<div id="Ong1"
style="padding: 10px; top: 0pt; left: 0pt; width: 310px; height: 160px; overflow: auto; font-size: 9px; background-color: rgb(0, 0, 0);"><span
style="font-weight: bold;"></span>
<table style="text-align: left; width: 100%;" border="0"
cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td
style="color: rgb(255, 255, 255); width: 30px; text-align: center; font-weight: bold;"><big><big><big>P.</big></big></big></td>
<td
style="color: rgb(255, 255, 255); font-weight: bold;"><big><big><big>Equipe</big></big></big></td>
<td
style="color: rgb(255, 255, 255); text-align: center; width: 30px; font-weight: bold;"><big><big><big>J</big></big></big></td>
<td
style="color: rgb(255, 255, 255); text-align: center; width: 30px; font-weight: bold;"><big><big><big>Pts</big></big></big></td>
</tr>
<tr>
<td
style="background-color: rgb(255, 255, 255); height: 2px;" colspan="4"
rowspan="1"></td>
</tr>
<tr>
<td
style="color: rgb(255, 255, 255); text-align: center; font-weight: bold;"><big><big>01</big></big></td>
<td
style="color: rgb(255, 255, 255); text-align: left; font-weight: bold;"><big><big>US
OPHAIN</big></big></td>
<td
style="color: rgb(255, 255, 255); text-align: center; font-weight: bold;"><big><big>0</big></big></td>
<td
style="color: rgb(255, 255, 255); text-align: center; font-weight: bold;"><big><big>0</big></big></td>
</tr>
<tr>
<td
style="color: rgb(255, 255, 255); text-align: center;"><big><big>02</big></big></td>
<td
style="color: rgb(255, 255, 255); text-align: left;"><big><big>A
venir</big></big></td>
<td
style="color: rgb(255, 255, 255); text-align: center;"><big><big>0</big></big></td>
<td
style="color: rgb(255, 255, 255); text-align: center;"><big><big>0</big></big></td>
</tr>
<tr>
<td
style="color: rgb(255, 255, 255); text-align: center;"><big><big>03</big></big></td>
<td
style="color: rgb(255, 255, 255); text-align: left;"><big><big>A
venir</big></big></td>
<td
style="color: rgb(255, 255, 255); text-align: center;"><big><big>0</big></big></td>
<td
style="color: rgb(255, 255, 255); text-align: center;"><big><big>0</big></big></td>
</tr>
<tr>
<td
style="color: rgb(255, 255, 255); text-align: center;"><big><big>04</big></big></td>
<td
style="color: rgb(255, 255, 255); text-align: left;"><big><big>A
venir</big></big></td>
<td
style="color: rgb(255, 255, 255); text-align: center;"><big><big>0</big></big></td>
<td
style="color: rgb(255, 255, 255); text-align: center;"><big><big>0</big></big></td>
</tr>
<tr>
<td
style="color: rgb(255, 255, 255); text-align: center;"><big><big>05</big></big></td>
<td
style="color: rgb(255, 255, 255); text-align: left;"><big><big>A
venir</big></big></td>
<td
style="color: rgb(255, 255, 255); text-align: center;"><big><big>0</big></big></td>
<td
style="color: rgb(255, 255, 255); text-align: center;"><big><big>0</big></big></td>
</tr>
<tr>
<td
style="background-color: rgb(255, 255, 255); height: 1px;" colspan="4"
rowspan="1"></td>
</tr>
<tr>
<td colspan="4" rowspan="1"
style="color: rgb(255, 255, 255); text-align: center;"><big><a
style="color: rgb(255, 255, 255);" href="/classement.html">Suite
du classement</a></big></td>
</tr>
</tbody>
</table>
<span style="font-weight: bold;"> </span></div>
<div id="Ong2"
style="padding: 10px; display: none; top: 0pt; left: 0pt; width: 310px; height: 160px; background-color: white;">
<table style="text-align: left; width: 100%;" border="0"
cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td
style="color: black; width: 30px; text-align: center; font-weight: bold;"><big><big><big>P.</big></big></big></td>
<td
style="color: black; width: 330px; font-weight: bold;"><big><big><big>Joueur</big></big></big></td>
<td
style="color: black; text-align: center; width: 30px; font-weight: bold;"><big><big><big>Buts</big></big></big></td>
</tr>
<tr>
<td style="background-color: black; height: 2px;"
colspan="4" rowspan="1"></td>
</tr>
<tr>
<td style="color: black; text-align: center;"><big><big>01</big></big></td>
<td style="color: black; text-align: left;"><big><big>US
OPHAIN</big></big></td>
<td style="color: black; text-align: center;"><big><big>0</big></big></td>
</tr>
<tr>
<td style="color: black; text-align: center;"><big><big>02</big></big></td>
<td style="color: black; text-align: left;"><big><big>A
venir</big></big></td>
<td style="color: black; text-align: center;"><big><big>0</big></big></td>
</tr>
<tr>
<td style="color: black; text-align: center;"><big><big>03</big></big></td>
<td style="color: black; text-align: left;"><big><big>A
venir</big></big></td>
<td style="color: black; text-align: center;"><big><big>0</big></big></td>
</tr>
<tr>
<td style="color: black; text-align: center;"><big><big>04</big></big></td>
<td style="color: black; text-align: left;"><big><big>A
venir</big></big></td>
<td style="color: black; text-align: center;"><big><big>0</big></big></td>
</tr>
<tr>
<td style="color: black; text-align: center;"><big><big>05</big></big></td>
<td style="color: black; text-align: left;"><big><big>A
venir</big></big></td>
<td style="color: black; text-align: center;"><big><big>0</big></big></td>
</tr>
<tr>
<td style="background-color: black; height: 1px;"
colspan="4" rowspan="1"></td>
</tr>
<tr>
<td colspan="4" rowspan="1"
style="color: black; text-align: center;"><big><a style="color: black;"
href="/buteurs.html">Suite
du classement</a></big></td>
</tr>
</tbody>
</table>
</div>
</td>
</tr>
</tbody>
</table>
</center>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</td>
</script>

Il s'agit du code HTML de mon menu de droite :P.

Puis dans ma page, à l'endroit ou je veux que le menu apparaisse, je met ceci :

<script language="JavaScript" SRC="http://www.usophain.com/essais/menu2/kitgraphique/menu_droite.js"></script>

Mais le problème c'est que le menu ne s'affiche pas ! :(
Pouvez-vous m'aider ? Merci :D

10 réponses

pyschopathe Messages postés 1974 Date d'inscription   Statut Membre Dernière intervention   135
 
Primo, les balises script doivent se trouver entre <head> et </head>.
Secundo, je ne vois pas du tout le rapport avec CSS.
Tertio, je ne comprends pas pourquoi tu mets ton code HTML dans ton fichier JS ?

Si tu veux faire marcher ton truc, tu peux faire une fonction Javascript, qui sera chargée de générer ton contenu et de l'insérer au bon endroit. Tu mets cette fonction dans un fichier externe si tu veux, qui sera inclus dans la partie <head> de ta page HTML. Ensuite, tu fais un évènement onload sur le document qui appelle ta fonction de génération de contenu.
0
letigre59 Messages postés 98 Date d'inscription   Statut Membre Dernière intervention   4
 
Bonjour,

C'est pas comme si les <td> était pas très recommandé et que le ciode n'était pas très propre ^^ t'a essayer en utilisant la méthode normal

<link rel=stylesheet href="style.css" type="text/css" media=screen />
entre les balisee <head> et </head> ?
0
pyschopathe Messages postés 1974 Date d'inscription   Statut Membre Dernière intervention   135
 
En fait il ne veut pas vraiment inclure du css, mais du code ! Et il n'y a pas que les tableaux qui soient moches dans ce code : les styles mélangés aux balises, des balises big... C'est pas du récent !
0
letigre59 Messages postés 98 Date d'inscription   Statut Membre Dernière intervention   4
 
Oui lol il veux include du code CSS dans ses balises ?
0
pyschopathe Messages postés 1974 Date d'inscription   Statut Membre Dernière intervention   135
 
Pire, il veut inclure du html comme si c'était du css au milieu de sa page ! C'est osé ^^ !
0
letigre59 Messages postés 98 Date d'inscription   Statut Membre Dernière intervention   4
 
Ah bah dans ce cas ^^ bonne après midi =D
0
pyschopathe Messages postés 1974 Date d'inscription   Statut Membre Dernière intervention   135
 
Toi t'aime pas le challenge, hein ^^ ! Bon aprèm' !
0

Vous n’avez pas trouvé la réponse que vous recherchez ?

Posez votre question
letigre59 Messages postés 98 Date d'inscription   Statut Membre Dernière intervention   4
 
Lol nan mais après va falloir l'adapter a IE 6 et IE 7 parce que ça va fonctionner sous Firefox et pas IE (comme toujours lol) et vue que j'ai pas plus de 3H devant moi ^^
0
pyschopathe Messages postés 1974 Date d'inscription   Statut Membre Dernière intervention   135
 
Boah, je crois qu'il y a un problème de conception à la base donc ça ne devrait pas aller bien loin de toutes façons ! A pluche tigrou ;-p !
0
letigre59 Messages postés 98 Date d'inscription   Statut Membre Dernière intervention   4
 
Oui a +
0
audric2121 Messages postés 11 Date d'inscription   Statut Membre Dernière intervention  
 
En fait, ce que je voulais faire c'est :

Mettre le code HTML du menu droit de ma page dans une page que je nomme : menu_droit.(Je ne sais pas quoi)

Puis je met un code à l'endroit de ma page où je veux que le menu apparaisse.

Je sais pas si c'est possible :S
0
audric2121 Messages postés 11 Date d'inscription   Statut Membre Dernière intervention  
 
C'est bon j'ai trouvé ce que je voulais faire...

Merci quand même ! Même si j'ai une vague impression de foutage de gueule ...
0
pyschopathe Messages postés 1974 Date d'inscription   Statut Membre Dernière intervention   135
 
On se moque un peu, mais faut bien se détendre ;-p

Tu peux indiquer comment tu t'y es pris pour faire ce que tu voulais stp, ça pourrait aider quelqu'un...
0
letigre59 Messages postés 98 Date d'inscription   Statut Membre Dernière intervention   4
 
Mais non tkt pas c'est pas méchant ;)
0
audric2121 Messages postés 11 Date d'inscription   Statut Membre Dernière intervention  
 
Ok :P
Bonne continuation :D
0