Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / JScript / August 2005

Tip: Looking for answers? Try searching our database.

change font colour

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Alvo von Cossel I - 22 Jul 2005 15:55 GMT
hi,
i am relatively new to javascript and am creating a website. its background
colour is orange and some people dont like the colour so i have javascript
options to change the background colour. one option is changing it to yellow
but the text is white so you cant see it very well. what JScript code do i
need to change the font colour to balck?

i hope i have made myself clear. if not, feel free to reply without an answer

Signature

Alvo von Cossel I of Germany

Serge Baltic - 22 Jul 2005 18:12 GMT
Hello,

AC> what JScript
AC> code do i
AC> need to change the font colour to balck?

document.body.style.backgroundColor = "<whatever-you-wish>";

By this I suppose that you set your white color with the BODY element style.

(H) Serge
Alvo von Cossel I - 22 Jul 2005 19:47 GMT
hi,

thanks for the tip. it works now. oh and by the way, how do i change the
font colour? i forgot to ask
Signature

Alvo von Cossel I of Germany

> Hello,
>
[quoted text clipped - 7 lines]
>
> (H) Serge
Sten Hougaard - 24 Jul 2005 10:00 GMT
Hi Alvo,

You should consult this site:
http://msdn.microsoft.com/workshop/author/css/reference/css_ref_entry.asp?frame=true

Here is a CSS reference, and IMHO MSDN Library is one of the best reference
sites on the web, always usefull :-)

/Sten Hougaard
Denmark

> hi,
>
[quoted text clipped - 13 lines]
>>
>> (H) Serge
Serge Baltic - 25 Jul 2005 16:27 GMT
Hello,

AC> thanks for the tip. it works now. oh and by the way, how do i change
AC> the font colour? i forgot to ask

Hmm your first question sounded like you've already managed to do it with
the color ;)

Well, http://msdn.microsoft.com/library/default.asp?url=/workshop/entry.asp?frame=true 
for all the things about the style.* properties.

And this http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/referen
ce/objects/div.asp
 
is a more convenient thing, select the "Styles" tab to see all the available
styles with short comments.

(H) Serg
mark.forster - 18 Aug 2005 16:35 GMT
> Hello,
>
[quoted text clipped - 12 lines]
>
> (H) Serge

A more efficient way to do this would be to have a style sheet with the
styles for the HTML elements you want and use javascript to dynamically
change the styles

Here are links to an artical i found about using javascript to switch your
style sheets.

http://www.alistapart.com/articles/alternate/ - for the artical and

http://www.alistapart.com/d/alternate/styleswitcher.js - for the source

By using this method you will not only keep your HTML cleaner but you will
have a better chance at maintaining your code in the future.

Read the artical. you will see what i mean

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.