|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here! |
|
#1
|
|||
|
|||
|
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 > |
|
#2
|
|||
|
|||
|
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?
|
|
#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. |
|
#4
|
|||
|
|||
|
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);
|
|
#5
|
|||
|
|||
|
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 < |
|
#6
|
|||
|
|||
|
RE: How can I change Font Type & Color?
Does anyone know if you can add a stylesheet to the code?
|
|
#7
|
|||
|
|||
|
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> |
|
#8
|
|||
|
|||
|
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" |
|
#9
|
|||
|
|||
|
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!
|
![]() |
| Viewing: Codewalkers Forums > Other Technologies > Client Side Things > How can I change Font Type & Color? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|