font face colour size - where to put the code?

  mco 16:35 02 Jun 06
Locked

I've got three snippets on my site: a 'good morning' one,a date& time one, and a 'last modified' one - but as they're all from different sources they are all different sizes/fonts etc. Below here is I believe the code I need to alter them to whatever font/colour/size I want - but question is: where do I put them into the snippets to get them to work? One of them doesn't actually say anything about fonts/sizes or colours anyway (though it still works)
FONT SIZE=+1 COLOR="000000" FACE="Arial">

  mco 16:36 02 Jun 06

here's the one which doesn't specify it. So where would I put my requirements?

<p><SCRIPT LANGUAGE="JavaScript">
<!-- Begin
datetoday = new Date();
timenow=datetoday.getTime();
datetoday.setTime(timenow);
thehour = datetoday.getHours();
if (thehour > 18) display = "Evening";
else if (thehour >12) display = "Afternoon";
else display = "Morning";
var greeting = ("Good " + display + "!");
document.write(greeting);
// End -->
</script>







 </p>

  Eric10 17:35 02 Jun 06

Put your font declaration inside the <p> tag. This is an example <p style="font:120% Arial; color:#000000;">. The font size can be altered by varying the percentage.
This is the same as <p style="font-size:120%; font-family:Arial; color:#000000;">

  Eric10 17:44 02 Jun 06

If you prefer to stick with the html that you have then you can put <font size=+1 color="000000" face="Arial"> immediately after the <p> tag and put </font> immediately before the </p> tag but my first method uses more current code.

  beynac 17:47 02 Jun 06

The relevant line is:
var greeting = ("<FONT SIZE=+1 COLOR='000000' FACE='Arial'>Good " + display + "!</FONT>");

Note single quotes around the color and face.

  Eric10 17:48 02 Jun 06

Sorry some errors crept into my last post and the code should read <font size="+1" color="#000000" face="Arial">.

  mco 17:48 02 Jun 06

will go off and try that then hopefully come back and tick 'resolved'

  mco 17:55 02 Jun 06

one of you says ' around colour and cace and the other shows " - so which is it?

  Eric10 18:14 02 Jun 06

The point beynac is making is that you cannot use double quotes inside double quotes. Since the original javascript that he has modified for you already uses double quotes then the parts within this code that also need to use quotes must use single quotes instead. These are the color definition '000000' and the face definition 'Arial'. This is because the javascript will treat a second double quote as a closing quote with unpredictable results.
Either of our methods will work although beynac's is neater as it sits inside the javascript but don't mix parts of my code with parts of his. Just use one or the other.

  mco 18:18 02 Jun 06

Thanks again - it works and I'm most appreciative! (I even managed to get it into bold myself so I'm doubly happy!)

This thread is now locked and can not be replied to.

What is Amazon Go and will it come to the UK? The store without checkouts or queues

1995-2015: How technology has changed the world in 20 years

Hands-on with the Star Wars fighting drones you can fly yourself

iPhone 9 and beyond: 32 amazing future smartphone developments - graphene, supercapacitor…