The Color of links
Moderator: General Moderators
The Color of links
is there a way of stopping a link from changing colors when you click it?
my link <a href...........>.......</a> starts off as blue then when i click it, it turns bright yellow? then when i close the web page and then re-open it, the links are still yellow?
my link <a href...........>.......</a> starts off as blue then when i click it, it turns bright yellow? then when i close the web page and then re-open it, the links are still yellow?
- RandomEngy
- Forum Contributor
- Posts: 173
- Joined: Wed Jun 26, 2002 3:24 pm
- Contact:
This will make all of your links pure blue:
The link is a regular unvisited link, the alink is the color after you click on it, and the vlink is the color of visited links. If those colors are not specified, the browser picks them.
Code: Select all
<body link="#0000FF" alink="#0000FF" vlink="#0000FF">
Last edited by RandomEngy on Fri Jul 26, 2002 3:20 pm, edited 1 time in total.
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
The best way to do this is to use style sheets (CSS). If you've never used CSS before start here:
http://www.devshed.com/Client_Side/Style_Sheets
The link and alink attributes in the body tag have been deprecated.
The following declaration in a style sheet will cause all links that have been visited or not to be the same colour and gives you a different colour for links when they are hovered over:
Mac
http://www.devshed.com/Client_Side/Style_Sheets
The link and alink attributes in the body tag have been deprecated.
The following declaration in a style sheet will cause all links that have been visited or not to be the same colour and gives you a different colour for links when they are hovered over:
Code: Select all
A:link, A:visited {
color: #ffffcc; /*change the colour to what you want */
}
A:hover {
color: #ffcccc; /* change the colour when you hover over the link */
}- RandomEngy
- Forum Contributor
- Posts: 173
- Joined: Wed Jun 26, 2002 3:24 pm
- Contact:
If you post twiglets code in the head of your document between a <style type="text/css"> and a </style> then it will work for all links in your page. If you want do it for individual links you can do <a href="page.html" style="color:blue;">Text</a> or using a class, defined in the style tags in the head like this:
and added to the link like this: <a href="test.html" class="special">Text</a>
Code: Select all
.special{
color:blue;
font-family: Verdana,Sans;
font-size: 10pt;}I'm glad i could make some people laugh with my questions!
Thanks for the tips! I got it to work. I used MattF's tip on doing it individually by link.
Thanks again!
One more question!
When i load my form, the first record is displayed and users can browse the contents with the "Next" and "Previous" links. I added a reset button
to clear the form, but when i press it it doesn't do anything?
echo "<input type=reset value=Reset>"
Thanks for the tips! I got it to work. I used MattF's tip on doing it individually by link.
Thanks again!
One more question!
When i load my form, the first record is displayed and users can browse the contents with the "Next" and "Previous" links. I added a reset button
to clear the form, but when i press it it doesn't do anything?
echo "<input type=reset value=Reset>"
The reset button doesn't actually clear the form, it just resets the input fields to their default settings.
You can clear all the fields with a simple JavaScript:
Note that this doesn't clear <select> fields in Netscape.
You can clear all the fields with a simple JavaScript:
Code: Select all
<input type="reset" value="Reset" onClick="clear_form(document.form_name); return false">
<!-- Or you could use document.formsї0] instead -->
<script language="JavaScript">
<!--
function clear_form(form_obj)
{
for (var x = 0; x < form_obj.elements.length; x++)
{
var type = form_obj.elementsїx].type;
if (type == 'checkbox' || type == 'radio')
{
// These must be cleared this way:
form_obj.elementsїx].checked = 0;
}
else if (type != 'submit' &&
type != 'reset' &&
type != 'hidden') // Don't clear these
{
form_obj.elementsїx].value = '';
}
}
}
//-->
</script>- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
Remember that if you do it individually by link then when you change your mind as to how it should appear you have to change every single link. The reason why CSS is so useful is that if you have it separate - ie. separate style from layout - then you only have to change one thing to change a whole site or page...
Please use the link to devshed and read about style sheets.
Mac
Please use the link to devshed and read about style sheets.
Mac