Client Side Things
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
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:
  #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: 25
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: 3
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: 3
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 8 m 12 sec
Reputation Power: 5
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




 Free IT White Papers!
 
Create the Optimal Architecture for your Critical Applications
Warburton's the largest independently owned bakery in the UK faced a number of difficult challenges in providing the most robust yet efficient IT infrastructure for their organization's success. IBM's services combined with their xSeries servers created the perfect platform for their SAP environment with sufficient flexibility, and did so in very time effective fashion.

Request Your Free Technology Downloads!
 
Five Best Practices for Deploying a Successful Service-Oriented Architecture
This white paper describes the benefits you can expect with SOA, and how IBM can help take your business there.

Request Your Free Technology Downloads!
 
Gartner Magic Quadrant for Application Delivery Controllers
Gartner summarizes its view on Application Delivery Controllers, evaluates strengths and weaknesses of solutions, and provides Magic Quadrant reporting for a quick comparison across all vendors. Learn from Gartner how you can benefit from an all-in-one device like Citrix NetScaler that delivers the highest levels of availability, performance and security.

Request Your Free Technology Downloads!
 
Knowledge is Power
What you don't know can hurt you, and is likely costing you money and increasing your security risks during an era of scarce resources. This white paper proposes six key strategies that enterprise security managers can use to improve their network defense posture.

Request Your Free Technology Downloads!
 
Rationalizing the Multi-Tool Environment
The rationalized multi-tool approach is flexible, scalable and cost effective. It provides the necessary input to the IT service management business processes. It preserves prior investments in monitoring tools, empowers technologists to select the best tools with which to do their jobs, and enhances effective response to incidents.

Request Your Free Technology Downloads!
 

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




© 2003-2010 by Developer Shed. All rights reserved. DS Cluster 11 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek