Client Side Things
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Try It Free
Go Back   Codewalkers ForumsOther TechnologiesClient Side Things

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here!
  #1  
Old February 22nd, 2005, 03:54 AM
MIO MIO is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Downey, CA
Posts: 12 MIO User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
How can I change Font Type & Color?

If Someone can tell me what to add and where to adda change of the font and color? Thanks in advance.

_________________________________________

<script language="JavaScript">


var dayName = new Array ("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday")

var monName = new Array ("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December")

var now = new Date

document.write("///Welcome to The Office: " + dayName[now.getDay()] + ", " + monName[now.getMonth()] + " "+now.getDate() +"")

//-->
</script

>

Reply With Quote
  #2  
Old February 22nd, 2005, 04:14 AM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
RE: How can I change Font Type & Color?

or is there any way to add my syle sheet to it so people cant change the font size on the browser?

Reply With Quote
  #3  
Old February 22nd, 2005, 09:16 AM
yatesy87 yatesy87 is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: St. Helens, Merseyside, England
Posts: 34 yatesy87 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: How can I change Font Type & Color?

This is what I do ... add this piece at the top of inside your script.

Code:
var TheFontFace  = "Arial";
var TheFontColor = "#000080";
var TheFontSize  = "1";
var TheFontStyle = "none"; 


Obviously just change the attributes to how you want em ... i use a similar script to what your using but in my case i only have to edit the script once if i want to change it coz i have placed it in my head script.

Reply With Quote
  #4  
Old February 22nd, 2005, 09:22 AM
yatesy87 yatesy87 is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: St. Helens, Merseyside, England
Posts: 34 yatesy87 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: How can I change Font Type & Color?

lol sorry i also forgot to put the last part of the code in ... my mistake ...

Add this before your script ends ...

Code:
if (TheFontStyle == "bold"){
    FontTagLeft = "<b>";
    FontTagRight ="</b>";}
    
if (TheFontStyle == "italic"){
    FontTagLeft = "<i>";
    FontTagRight ="</i>";}
    
if (TheFontStyle == "bolditalic"){
    FontTagLeft = "<b><i>"; 
    FontTagRight = "</i></b>";}    

var D = "";
D += "<font color='"+TheFontColor+"' face='"+TheFontFace+"' size='"+TheFontSize+"'>";
D += FontTagLeft+Day+TheMonthDay+TheSeparator+TheMonth+  TheSeparator+TheYear+FontTagRight;
D += "</font>";

document.write(D);

Reply With Quote
  #5  
Old February 22nd, 2005, 06:18 PM
MIO MIO is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Downey, CA
Posts: 12 MIO User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
RE: How can I change Font Type & Color?

I still cant get this script to work. Can I add a styles sheet so no one can change the text size? If not I would just like to match the text size and color to my site. Thanks again for the help.

script
__________________________________________________ ______________________________

<script language="JavaScript">

var TheFontFace = "Arial";
var TheFontColor = "#cccccc";
var TheFontSize = "3";
var TheFontStyle = "bold";

var dayName = new Array ("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday")

var monName = new Array ("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December")

var now = new Date

document.write("///Welcome to The Office: " + dayName[now.getDay()] + ", " + monName[now.getMonth()] + " "+now.getDate() +"")

if (TheFontStyle == "bold"){
FontTagLeft = "<b>";
FontTagRight ="</b>";}

if (TheFontStyle == "italic"){
FontTagLeft = "<i>";
FontTagRight ="</i>";}

if (TheFontStyle == "bolditalic"){
FontTagLeft = "<b><i>";
FontTagRight = "</i></b>";}

var D = "";
D += "<font color='"+TheFontColor+"' face='"+TheFontFace+"' size='"+TheFontSize+"'>";
D += FontTagLeft+Day+TheMonthDay+TheSeparator+TheMonth+ TheSeparator+TheYear+FontTagRight;
D += "</font>";

document.write(D);

</script

<

Reply With Quote
  #6  
Old February 23rd, 2005, 07:40 AM
MIO MIO is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Downey, CA
Posts: 12 MIO User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
RE: How can I change Font Type & Color?

Does anyone know if you can add a stylesheet to the code?

Reply With Quote
  #7  
Old February 23rd, 2005, 09:21 AM
MIO MIO is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Downey, CA
Posts: 12 MIO User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
RE: How can I change Font Type & Color?

Okay I found this script to work with font type and color...

Now My question is how can I add a stylesheet to the code and where should I put it..

the name of my stylesheet name is stylesheet.css and is in the same directory that this script is in.

I don't want people to be able to change the text size on the view drop down menu.

Thanks for your help!

__________________________________________________ ___________________________

<script>

var mydate=new Date()
var year=mydate.getYear()
if (year < 1000)
year+=1900
var day=mydate.getDay()
var month=mydate.getMonth()
var daym=mydate.getDate()
if (daym<10)
daym="0"+daym
var dayarray=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
var montharray=new Array("January","February","March","April","May","June","July","August","September","October","November","December")
document.write("<small><font size='3' font color='CCCCCC' face='Arial'><strong><b>///Welcome to The Office: " +dayarray[day]+", "+montharray[month]+" "+daym+", "+year+"</b></font></small>")

</script>

Reply With Quote
  #8  
Old February 23rd, 2005, 01:16 PM
nawlej nawlej is offline
Contributing User
Codewalkers Regular (2000 - 2499 posts)
 
Join Date: Apr 2007
Location: Dallas, Tx. USA
Posts: 2,008 nawlej User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 h 7 m 51 sec
Reputation Power: 4
RE: How can I change Font Type & Color?

If I were you I would stay away from font tag attributes...it gets messy. Just link a stylesheet to the site directly, and you can toggle the attributes with javascript.

The syntax for accessing a stylesheet attribute:

Code:
document.getElementById(objectID).property


for instance, to change the font color of the class "myclass" and id "myfont" to white:

Code:
document.getElementById(myfont).color = "#FFFFFF"

Reply With Quote
  #9  
Old February 23rd, 2005, 06:10 PM
MIO MIO is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Downey, CA
Posts: 12 MIO User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
RE: How can I change Font Type & Color?

okay where in the code I provided shoud I put this? The page on which the script is on already has a stylesheet attached, I named it stylesheet.css. I'm just not to sure of where to put the lines you gave me. Thanks for the help!

Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesClient Side Things > How can I change Font Type & Color?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

Try It Free




© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway