Rechercher : dans
Par :

Appel d'une page CSS

Dernière réponse le 26 mai 2009 à 11:19:41 audric2121, le 24 mai 2009 à 17:43:29 
 Signaler ce message aux modérateurs

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 - http://www.jejavascript.net/
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

Configuration: Windows Vista
Firefox 3.0.10

Meilleures réponses pour « Appel d'une page CSS » dans :
Javascript - Centrer verticalement une page web VoirPour centrer verticalement une page web, impossible de s'en sortir en css. Une solution bien pratique : JavaScript. 1. Le fichier .js 2. La page .html 3. Utilisation 4. Inconvénients 5. Rappel Merci à Dalida pour la source du...
Créer un site beau, dynamique et respectueux des standards VoirVoici une liste de liens qui vous aideront à mieux exploiter les standards (HTML, CSS, DOM...) pour créer des sites plus beaux, plus dynamiques et plus respectueux des standards. A la fin de cette page, il y a également une liste de...
[Web] Eliminer totalement les publicités dans les pages WEB VoirVoici une méthode radicale et simple pour éliminer 99% des publicités dans les pages web, quel que soit le site et quel que soit le type de publicité (popup, incluse, bannière, flash, IFrame, Java, CSS, applet Java...) 1. Installez...
Les classes de style (CSS) VoirLes classes et les ID Les classes Il peut s'avérer intéressant d'affecter des styles différents à des mêmes balises. Pour cela les spécifications CSS ont introduit le concept de classe. La définition des classes est aussi simple que celles des...
CSS - Les couleurs VoirLes couleurs Le standard CSS propose différentes façons de définir des couleurs : par un nom avec la notation hexadécimale avec la notation décimale Appel d'une couleur par son nom Le langage HTML définit des noms pour un nombre limité de...
La syntaxe des style (CSS) VoirDéfinition d'un style La définition d'un style se fait à l'aide de règles en texte simple permettant de décrire l'aspect des éléments de la page. Une règle CSS est caractérisée par deux principaux éléments : Un sélecteur de balises, permettant de...

1

pyschopathe, le 24 mai 2009 à 19:58:12

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.

Répondre à pyschopathe

2

letigre59, le 25 mai 2009 à 14:22:41

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> ?

Répondre à letigre59

3

pyschopathe, le 25 mai 2009 à 14:26:48

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 !

Répondre à pyschopathe

4

letigre59, le 25 mai 2009 à 14:32:02

Oui lol il veux include du code CSS dans ses balises ?

Répondre à letigre59

5

pyschopathe, le 25 mai 2009 à 14:38:13

Pire, il veut inclure du html comme si c'était du css au milieu de sa page ! C'est osé ^^ !

Répondre à pyschopathe

6

letigre59, le 25 mai 2009 à 14:39:23

Ah bah dans ce cas ^^ bonne après midi =D

Répondre à letigre59

7

pyschopathe, le 25 mai 2009 à 14:40:05

Toi t'aime pas le challenge, hein ^^ ! Bon aprèm' !

Répondre à pyschopathe

8

letigre59, le 25 mai 2009 à 14:41:29

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 ^^

Répondre à letigre59

9

pyschopathe, le 25 mai 2009 à 14:43:40

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 !

Répondre à pyschopathe

10

letigre59, le 25 mai 2009 à 14:45:52

Oui a +

Répondre à letigre59

11

audric2121, le 25 mai 2009 à 18:15:26

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

Répondre à audric2121

12

audric2121, le 25 mai 2009 à 18:37:41

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 ...

Répondre à audric2121

15

 pyschopathe, le 26 mai 2009 à 11:19:41

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...

Répondre à pyschopathe

13

letigre59, le 25 mai 2009 à 21:54:30

Mais non tkt pas c'est pas méchant ;)

Répondre à letigre59

14

audric2121, le 25 mai 2009 à 22:10:21

Ok :P
Bonne continuation :D

Répondre à audric2121
Collection CommentÇaMarche.net