Help with HTML Code for Automatic...

User 2249012 Photo


Registered User
3 posts

Hello!

I'm struggling to get this code to work the way I want it to on my site. Here is what I am starting with:

<script language="JavaScript">
<!--
document.write('&copy;' );
document.write(' Copyright ');
document.write(' 2014 - ');
document.write(new Date().getFullYear());
document.write(' | All Rights Reserved');
//-->
</script>

I want to change the font size and family to Verdana 13px and I want it to read 2014-15 instead of 2014-2015.

Any ideas?

Thanks in advance.
User 2249012 Photo


Registered User
3 posts

Okay...I figured most of it out. Now just having issues doing both font change and Get Full Year. Here's what I have....need help on incorporating font to the get full year line....

<script language="JavaScript">
<!--
document.write("<FONT FACE='verdana'.FONT SIZE='13'>&copy</FONT>");
document.write("<FONT FACE='verdana'.FONT SIZE='13'>Copyright</FONT>");
document.write("<FONT FACE='verdana'.FONT SIZE='13'>2014-</FONT>");
document.write(new Date().getFullYear().toString().substr(2,2));
document.write("<FONT FACE='verdana'.FONT SIZE='13'> | All Rights Reserved</FONT>");
//-->
</script>
User 389612 Photo


Registered User
41 posts

This is a modification of what I've used for my perpetual copyright. I used this to get today's year of 2015 because I wanted full years. Initially, I did this because I got tired of having to either update 25+ pages with a new copyright year.

I updated my normal code with your request for Verdana 13 font and with your request for 2014. I also left a fall san serif font there in case someone's system doesn't have Verdana on it.

It can be done with 1 document.write.
<script language="Javascript">
// Perpetual Copyright Date so that it never has to be updated ever AGAIN!
var mydate=new Date();
var year=mydate.getYear();
if (year < 1000) year+=1900;
document.write('<span style="font-family: Verdana, sans-serif; font-size: 13pt;">&copy; 2014 - '+year+' Copyright_Holder_Name_here&nbsp;&nbsp;All rights reserved.</span>')
</script>

What you get is:
© 2014 - 2015 Copyright_Holder_Name_here All rights reserved.

I hope this helps you out.
User 2249012 Photo


Registered User
3 posts

THANK YOU! That is so much easier than what I was trying to do.

User 2899602 Photo


Guest
2 posts

Great tip. Many thanks, WMammel.
Quick question: I am trying to place and HTML frame with the above code on a green background and need the text to be white. I tried adding "font-color: #FFFFFF;" after your "font-size: 11pt;", but that did not work. Wishful thinking, I suppose.
Any suggestions? Thanks in advance!
Best regards,
JOS
User 187934 Photo


Senior Advisor
20,181 posts
Online Now

<div style="background-color:green; color:#FFFFFF"><script>
var mydate=new Date();
var year=mydate.getYear();
if (year < 1000) year+=1900;
document.write('<span style="font-family: Verdana, sans-serif; font-size: 13pt;">&copy; 2014 - '+year+' Copyright_Holder_Name_here&nbsp;&nbsp;All rights reserved.</span>')
</script></div>
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 2899602 Photo


Guest
2 posts

Many thanks, Eric!

Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.