...

View Full Version : Date script....



prise2admin
02-17-2005, 12:07 AM
Hi, I have a script for the date but I want it in arial underline... how can i do that... here my script..( and if you have a shorter code (for the date in french...) I will like that...)



HERE THE HEAD PART...

<SCRIPT LANGUAGE="JavaScript">
navvers = navigator.appVersion.substring(0,1);
if (navvers > 3)
navok = true;
else
navok = false;

today = new Date;
jour = today.getDay();
numero = today.getDate();
if (numero<10)
numero = "0"+numero;
mois = today.getMonth();
if (navok)
annee = today.getFullYear();
else
annee = today.getYear();
TabJour = new Array("Dimanche","Lundi","Mardi","Mercredi","Jeudi","Vendredi","Samedi");
TabMois = new Array("janvier","février","mars","avril","mai","juin","juillet","aout","septembre","octobre","novembre","dééembre");
messageDate = TabJour[jour] + " " + numero + " " + TabMois[mois] + " " + annee;
</SCRIPT>

HERE THE BODY PART...

<SCRIPT LANGUAGE="JavaScript">
document.write(messageDate);
</SCRIPT>

whizard
02-17-2005, 12:13 AM
CSS


p.date
{
font-family:Arial,Helvetica,Verdana;
font-size:medium;
color:#ff0000;
}

HTML/JS


<p class="date">
<script>
<!--
document.write(messageDate);
//-->
</script>
</p>
Dan

prise2admin
02-17-2005, 12:15 AM
im not good with css can you write the script with detail ( like head part...) thankyou!!!

whizard
02-17-2005, 12:40 AM
<html>
<head>
<SCRIPT LANGUAGE="JavaScript">
navvers = navigator.appVersion.substring(0,1);
if (navvers > 3)
navok = true;
else
navok = false;

today = new Date;
jour = today.getDay();
numero = today.getDate();
if (numero<10)
numero = "0"+numero;
mois = today.getMonth();
if (navok)
annee = today.getFullYear();
else
annee = today.getYear();
TabJour = new Array("Dimanche","Lundi","Mardi","Mercredi","Jeudi","Vendredi","Samedi");
TabMois = new Array("janvier","février","mars","avril","mai","juin","juillet","aout","septembre","octobre","novembre","dééembre");
messageDate = TabJour[jour] + " " + numero + " " + TabMois[mois] + " " + annee;
</SCRIPT>

<!-- Style for p.date -->
<style>
p.date
{
font-family:Arial,Helvetica,Verdana;
font-size:medium;
color:#ff0000; /*(red)*/
}
</style>

</head>
<body>
<p class="date">
<script>
<!--
document.write(messageDate);
//-->
</script>
</p>
</body>
</html>

---OR---

if you have an external style sheet,


<html>
<head>
<SCRIPT LANGUAGE="JavaScript">
navvers = navigator.appVersion.substring(0,1);
if (navvers > 3)
navok = true;
else
navok = false;

today = new Date;
jour = today.getDay();
numero = today.getDate();
if (numero<10)
numero = "0"+numero;
mois = today.getMonth();
if (navok)
annee = today.getFullYear();
else
annee = today.getYear();
TabJour = new Array("Dimanche","Lundi","Mardi","Mercredi","Jeudi","Vendredi","Samedi");
TabMois = new Array("janvier","février","mars","avril","mai","juin","juillet","aout","septembre","octobre","novembre","dééembre");
messageDate = TabJour[jour] + " " + numero + " " + TabMois[mois] + " " + annee;
</SCRIPT>

<!-- Code to import ext. style sheet -->
<link href="path/to/stylesheet" rel="stylesheet" type="text/css">
</head>
<body>
<p class="date">
<script>
<!--
document.write(messageDate);
//-->
</script>
</p>
</body>
</html>

Dan

prise2admin
02-17-2005, 01:40 AM
its don't work... :(

truviet911
02-17-2005, 01:51 AM
its don't work... :(
try it again it will work . i did test it .

whizard
02-17-2005, 01:52 AM
You mean the script doesnt output the date with an underline? Thats cause I forgot to put underline into the CSS code.

Add this line to the CSS command (inbetween the <style> tags.)


text-decoration:underline;

If the code isn't writing the date at all, then there's something wrong with the script, and I don't know JS at all really, but you should try the JS forum.

Dan

Yeah, I just tested it, and it works when you put the above code in.
Dan

prise2admin
02-17-2005, 02:00 AM
when i try it in a new document it work but in my complete code it don' work :confused: so here my complete code:


erased...

whizard
02-17-2005, 02:06 AM
Take out the exclamation points (!) from the ends of your comments on the first four lines and it'll work fine. What was happening was that you were commenting out the entire head section of your page, because of improperly coding the comment. therefore, the browser didn't know what "messagedate" was, and gave an error.

Correct HTML comment: <!-- Blah Blah -->

Also, just as friendly advice, you should clean up your code a little. There are a lot of un closed tags, and the like.

Dan

prise2admin
02-17-2005, 02:13 AM
NOW ITS WORK!!!! thanks you for the tips... :thumbsup:

prise2admin
02-17-2005, 02:15 AM
but the date is not underlined how can i underline it... :(

whizard
02-17-2005, 02:19 AM
See post # 7 in this thread (http://www.codingforums.com/showpost.php?p=275792&postcount=7)

Also, don't feel stupid about the comments, check out this thread that I just
replied to...

http://www.codingforums.com/showthread.php?t=52567

talk about stupidity on MY part....

Dan

prise2admin
02-17-2005, 02:20 AM
sorry i dont view... :o

whizard
02-17-2005, 02:22 AM
add this in your style tag to get underlines:

text-decoration:underline;

;) Dan

prise2admin
02-17-2005, 02:41 AM
i had viewing it before, i make a error my in my last post.. we are suposed to viee sory i had not view it...

whizard
02-17-2005, 02:43 AM
could you rephrase the last bit? I'm not quite sure I grasp what you are saying

Dan



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum