11550 sujets

JavaScript, DOM et API Web HTML5

Bonjour
Je suis nul de chez Smiley bawling nul en JavaScript quelqu'un peut-il m’aider
Je voudrais avec ce script qui affiche le saint du jour, afficher une page « jour_mois.htm »
Es possible si oui comment faire
Merci

<!-- Je cache pour les vieux browsers
function display_anni() {

date = new Date();
var day_of_week_number = date.getDay();
var day_of_month_number = date.getDate();
var month_number = date.getMonth();
var year = date.getYear();
var day_of_week = '';
var month = ''

if((day_of_month_number == 1) && (month_number == 9)){day_of_year = 'Ste Th&eacute;r&egrave;se de l\' E.-J.';}
if((day_of_month_number == 2) && (month_number == 9)){day_of_year = 'St L&eacute;ger';}
if((day_of_month_number == 3) && (month_number == 9)){day_of_year = 'St G&eacute;rard';}
if((day_of_month_number == 4) && (month_number == 9)){day_of_year = 'St Fran&ccedil;ois d\' Assise';}
if((day_of_month_number == 5) && (month_number == 9)){day_of_year = 'Ste Fleur';}
if((day_of_month_number == 6) && (month_number == 9)){day_of_year = 'St Bruno';}
if((day_of_month_number == 7) && (month_number == 9)){day_of_year = 'St Serge';}
if((day_of_month_number == 8) && (month_number == 9)){day_of_year = 'Ste P&eacute;lagie';}
if((day_of_month_number == 9) && (month_number == 9)){day_of_year = 'St Denis';}
if((day_of_month_number == 10) && (month_number == 9)){day_of_year = 'St Ghislain';}
if((day_of_month_number == 11) && (month_number == 9)){day_of_year = 'St Firmin';}
if((day_of_month_number == 12) && (month_number == 9)){day_of_year = 'St Wilfried';}
if((day_of_month_number == 13) && (month_number == 9)){day_of_year = 'St G&eacute;raud';}
if((day_of_month_number == 14) && (month_number == 9)){day_of_year = 'St Juste';}
if((day_of_month_number == 15) && (month_number == 9)){day_of_year = 'Ste Th&eacute;r&egrave;se d\'Avila';}
if((day_of_month_number == 16) && (month_number == 9)){day_of_year = 'St Edwige';}
if((day_of_month_number == 17) && (month_number == 9)){day_of_year = 'St Baudouin';}
if((day_of_month_number == 18) && (month_number == 9)){day_of_year = 'St Luc';}
if((day_of_month_number == 19) && (month_number == 9)){day_of_year = 'St Ren&eacute;';}
if((day_of_month_number == 20) && (month_number == 9)){day_of_year = 'Ste Adeline';}
if((day_of_month_number == 21) && (month_number == 9)){day_of_year = 'Ste C&eacute;line';}
if((day_of_month_number == 22) && (month_number == 9)){day_of_year = 'Ste Elodie';}
if((day_of_month_number == 23) && (month_number == 9)){day_of_year = 'St Jean de C.';}
if((day_of_month_number == 24) && (month_number == 9)){day_of_year = 'St Florentin';}
if((day_of_month_number == 25) && (month_number == 9)){day_of_year = 'St Cr&eacute;pin';}
if((day_of_month_number == 26) && (month_number == 9)){day_of_year = 'St Dimitri';}
if((day_of_month_number == 27) && (month_number == 9)){day_of_year = 'Ste Emeline';}
if((day_of_month_number == 28) && (month_number == 9)){day_of_year = 'Sts Simon, Jude';}
if((day_of_month_number == 29) && (month_number == 9)){day_of_year = 'St Narcisse';}
if((day_of_month_number == 30) && (month_number == 9)){day_of_year = 'Ste Bienvenue';}
if((day_of_month_number == 31) && (month_number == 9)){day_of_year = 'St Quentin';}

var date_to_show = day_of_year;

document.write('Nous f&ecirc;tons : ' + date_to_show.fontcolor("#000000") + '</font>');

} //end display anni
// je ne cache plus -->
display_anni();
(sujet déplacé dans le bon salon).

Hello saintquentinois et bienvenue Smiley smile ,

En tant que modérateur, je me dois de te faire remarquer que tu n'as malheureusement pas respecté l'une des Règles de base du forum qui est d'afficher les codes et exemples proprement à l'aide des boutons [ code]... ici ton code HTML, CSS, PHP, etc.[ /code] (sans espace).

upload/1-code.gif

Je te remercie par avance de bien vouloir éditer ton message afin de le rendre conforme à cette règle. Smiley cligne

D'ailleurs, je rappelle que le lien qui apparaît en bandeau tout en haut du forum ("Nouveau sur le forum ?...") est important. Il contient des pistes de recherche, des indications sur les règles de vie de la communauté, etc.
Il serait donc courtois de ta part de bien vouloir en prendre connaissance.

Bonne continuation Smiley smile
L'utilisation de Javascript pour ce genre de choses n'est pas pertinent il faudrait que tu te tournes plutôt vers un langage serveur et une source de données (base de données, fichier xml ou autres). Smiley smile