Wrox Programmer Forums
|
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 7th, 2004, 10:33 AM
Authorized User
 
Join Date: Oct 2003
Posts: 96
Thanks: 0
Thanked 0 Times in 0 Posts
Default set text color

I would like to set the color on this to white. [u]I have tried the following but it didn't work</u>. I would like to stay away from using the Close Window tags.

<div style="text-align: right color: white;"><a href='javascript:top.close()'>Close Window</a></div>

Rudy
__________________
Rudy
 
Old July 7th, 2004, 11:10 AM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi Rudy,

You need a ";" between "right" & "color"...

text-align: right; color: white;

HTH,

Chris

 
Old July 7th, 2004, 11:23 AM
Authorized User
 
Join Date: Oct 2003
Posts: 96
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Chris

I tried both of these and still it didn't change the color.

<div style="text-align: right; color: white"><a href='javascript:top.close()'>Close Window</a></div>

<div style="text-align: right; color: white;"><a href='javascript:top.close()'>Close Window</a></div>



Rudy
 
Old July 7th, 2004, 11:35 AM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hey Rudy,

Sorry, been a long day. That'll be the style of your a tag overriding it, try...

Code:
<div style="text-align: right;"><a style="color: white;" href="#">myLink</a></div>
Cheers,

Chris

 
Old July 7th, 2004, 11:56 AM
Authorized User
 
Join Date: Oct 2003
Posts: 96
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yes, Chris that worked.

For browser compatiblity concerns is the syntax on this correct, seems a bit strange


Code:
<div style="text-align: right;"><a style="color: white;" <a href='javascript:top.close()'>Close Window</a></div>
Rudy
 
Old July 7th, 2004, 12:00 PM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi Rudy,

No, you only need one a tag...

Code:
<div style="text-align: right;">
    <a style="color: white;" href="javascript:top.close()">
        Close Window
    </a>
</div>
Best regards,

Chris

 
Old July 7th, 2004, 12:14 PM
Authorized User
 
Join Date: Oct 2003
Posts: 96
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks Chris,

I didn't think the way I had it was right. It did work with the extra (a) tag in IE, but some browsers may not have overlooked it. I'm very new to some of this. Thanks for your help and patience - I have it right now.



Rudy
 
Old July 7th, 2004, 12:27 PM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi Rudy,

IE is far too forgiving!!!

Just in case you wanted to play with hover styles etc, this may be of use...

Code:
<style type="text/css">
#CloseLink{
    text-align: right;
}
#CloseLink a{
    color: white;
}
#CloseLink a:hover{
    color: blue;
}
</style>

...

<div id="CloseLink">
    <a href="javascript:top.close()">
        Close Window
    </a>
</div>
Best regards,

Chris

 
Old July 7th, 2004, 12:33 PM
Authorized User
 
Join Date: Oct 2003
Posts: 96
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yes Chris, that's just the kind of CSS code I'm looking for. This should look good on the very plain links I have now.

I just started learning and reading about CSS.
Got anymore of this great code I would love to see it.

Thanks again :)


Rudy
 
Old July 8th, 2004, 01:01 AM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 331
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to qazi_nomi
Default

Dear in CSS links are define like this


a.decor6:link {color: #ffffff; text-decoration: none}
a.decor6:visited {color: #ffffff; text-decoration: none}
a.decor6:hover {
    text-decoration: underline;
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 10px;
    font-weight: normal;
    color: #ffffff;

Love 4 all





Similar Threads
Thread Thread Starter Forum Replies Last Post
how to set the backgound-color dynamically Neha XSLT 7 July 10th, 2008 07:17 AM
how we can set background color in xslt abhi.prince4u XSLT 2 July 4th, 2007 02:22 AM
Set Background color using RGb value sudarshan73 Reporting Services 1 January 11th, 2007 03:35 PM
Need to change color of text in a text box? larry HTML Code Clinic 6 December 29th, 2006 05:14 AM
Can't set text property of dynamic text box sreerajrs ASP.NET 1.0 and 1.1 Professional 1 May 31st, 2006 09:39 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.