/    Sign up×
Community /Pin to ProfileBookmark

Can anyone solve this one?

Hi. Here’s my problem:

<a style=”text-decoration:none” href=”…”> <font onMouseOver=”this.style.color=’#FF9900′” onMouseOut=”this.style.color=’#003399′” face=”Arial” color=”#003399″>…</font></a>

The onMouseOver and onMouseOut attribute of the <font> tag does not work in some browsers. However it achieves the desired result: the text is dark blue in color and is highlighted orange when you hover over it. It goes back to dark blue when you move the mouse out.

<font face=”Arial” color=”003399″> <a style=”text-decoration:none” onMouseOver=”this.style.color=’#FF9900′” onMouseOut=”this.style.color=’#003399′” href=”…”>…</a></font>

In this above scenario the text is blue to begin with(the normal blue of any link) and highlights orange when you hover over it. It becomes dark blue when you move the mouse out. Everything works normally except at the start when it is bright blue.

If I change things so that the <font> tag is on the inside of the <a> tag the text is dark blue but will not highlight orange.

How do i achieve the result of the first example and be browser-friendly at the same time?

Thanks

to post a comment
JavaScript

7 Comments(s)

Copy linkTweet thisAlerts:
@Daniel_TJul 11.2004 — Don't use JavaScript on font tags. Actually, don't use font tags at all. use spans.
&lt;a style="text-decoration:none" href="..."&gt; &lt;span onMouseOver="this.style.color='#FF9900'" onMouseOut="this.style.color='#003399'" style="font-family: Arial; color: #003399"&gt;...&lt;/span&gt;&lt;/a&gt;
-Dan
Copy linkTweet thisAlerts:
@Paul_JrJul 11.2004 — [font=georgia]How about we use CSS instead of either of those.[/font]
[size=1]
&lt;style type="text/css"&gt;
a:link, a:visited {
font-family: arial, verdana, sans-serif;
color: #039;
text-decoration: none;
}
a:hover {
color: #F90;
}
&lt;/style&gt;
&amp;#8230; &amp;#8230; &amp;#8230;
&lt;a href="" title=""&gt;Link; click me&lt;/a&gt;
[/size]

[font=georgia]It is simple, easy, logical, and very browser-friendly &#8212; more so than JavaScript in this situation.[/font]
Copy linkTweet thisAlerts:
@jpduckmanauthorJul 11.2004 — You have defined the style but how does one incorporate it in the link?
Copy linkTweet thisAlerts:
@Daniel_TJul 11.2004 — [i]Originally posted by jpduckman [/i]

[B]You have defined the style but how does one incorporate it in the link? [/B][/QUOTE]
It already is. Copy and paste that code and see for yourself...
Copy linkTweet thisAlerts:
@Paul_JrJul 11.2004 — [font=georgia]As Dan said, the styles have been applied. Those styles will affect every link on the page. To affect certain links, you can use classes, IDs, descendant selectors, and many more. For a nice big ol&#8217; list of selectors, go <[url=http://www.w3.org/TR/REC-CSS2/selector.html]here[/url]>

You can learn about CSS <[url=http://www.w3schools.com/css/]here, at W3schools.com[/url]>

[/font]
Copy linkTweet thisAlerts:
@jpduckmanauthorJul 11.2004 — Thanks, it all works now.

Jiby
Copy linkTweet thisAlerts:
@Paul_JrJul 11.2004 — [i]Originally posted by jpduckman [/i]

[B]Thanks, it all works now.

Jiby [/B]
[/QUOTE]

[font=georgia]Awesome. Glad you got it working. ?[/font]
×

Success!

Help @jpduckman spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...