Applying CSS Styles to Javascript Rollovers

D

Dinsdale

Without using CSS styles or linked stylesheets, I need to apply
formatting to text links that use rollover effects.

I can NOT get the underline to show using this technique:

<A onmouseover="this.style.color='#000000'" style="FONT-SIZE: 12pt;
COLOR: #000000; FONT-FAMILY: Arial, Helvetica; TEXT-DECORATION:
underline;"
onmouseout="this.style.color='#000000' TEXT-DECORATION: none;"
href="#">Search</A>

This isn't the way I normally work - I use CSS styles applied to <a>
tags. I won't bother taking the time to explain why!

Any suggestions? Can various CSS styles (backgrounds, colors, borders,
etc) be applied to text using Javascript rollovers?

Thanks!
 
E

Evertjan.

Dinsdale wrote on 19 jan 2007 in comp.lang.javascript:
Without using CSS styles or linked stylesheets, I need to apply
formatting to text links that use rollover effects.

I can NOT get the underline to show using this technique:

<A onmouseover="this.style.color='#000000'" style="FONT-SIZE: 12pt;
COLOR: #000000; FONT-FAMILY: Arial, Helvetica; TEXT-DECORATION:
underline;"
onmouseout="this.style.color='#000000' TEXT-DECORATION: none;"
href="#">Search</A>

This isn't the way I normally work - I use CSS styles applied to <a>
tags. I won't bother taking the time to explain why!

So why should we bother at all?
Any suggestions? Can various CSS styles (backgrounds, colors, borders,
etc) be applied to text using Javascript rollovers?

Yes.
 
D

Dinsdale

I'm working within a web-based tool that creates e-learning web sites.
I can only edit snippets of code at a time, not the whole page.

I don't have access to the HEAD section of the page, to declare <style
type="text/css" media="screen">, nor do I have the ability to link to
external style sheets.

I only know a little Javascript, so adding formatting like this is
difficult. I've experimented with a variety of code, but can't get the
effect I to work.
 
A

ASM

Dinsdale a écrit :
Without using CSS styles or linked stylesheets, I need to apply
formatting to text links that use rollover effects.

I can NOT get the underline to show using this technique:

perhaps without forgetting the ';' missing ?
and using correct JS term for your styles

<A style="COLOR: #000000; FONT-FAMILY: Arial, Helvetica;
FONT-SIZE: 12pt; TEXT-DECORATION: underline;"
onmouseover="this.style.color='#000000';
this.style.textDecoration = 'none';"
onmouseout=" this.style.color= '#000000';
this.style.textDecoration = 'underline';"
href="#">Search</A>


and better again :


<a style="text-decoration: underline; font-family: Arial, Helvetica;
font-size: 12pt; color: #000000;"
onmouseover="this.style.color = '#000000';
this.style.textDecoration = 'none';"
onmouseout=" this.style.color= '#000000';
this.style.textDecoration = 'underline';"
href="#">Search</a>
 
E

Evertjan.

Dinsdale wrote on 19 jan 2007 in comp.lang.javascript:
[Please do not toppost on usenet]
I'm working within a web-based tool that creates e-learning web sites.
I can only edit snippets of code at a time, not the whole page.

I don't have access to the HEAD section of the page, to declare <style
type="text/css" media="screen">, nor do I have the ability to link to
external style sheets.

<style> can be set in the <body>, most browser types do not seem to
complain. It is not elegant, but with the constraints you accepted, ...

However you can always set inline CSS:

<span style='color:red;'>Your text bit</span>

You better start learning about CSS, and do Javascript later.
I only know a little Javascript, so adding formatting like this is
difficult. I've experimented with a variety of code, but can't get the
effect I to work.

??

Setting the style of an html element is quite possible,
but first you would have to know CSS rather well.

Try:

<http://w3schools.com/css/default.asp>
 
D

Dinsdale

Evertjan. said:
Dinsdale wrote on 19 jan 2007 in comp.lang.javascript:
[Please do not toppost on usenet]
I'm working within a web-based tool that creates e-learning web sites.
I can only edit snippets of code at a time, not the whole page.

I don't have access to the HEAD section of the page, to declare <style
type="text/css" media="screen">, nor do I have the ability to link to
external style sheets.

<style> can be set in the <body>, most browser types do not seem to
complain. It is not elegant, but with the constraints you accepted, ...

However you can always set inline CSS:

<span style='color:red;'>Your text bit</span>

You better start learning about CSS, and do Javascript later.
I only know a little Javascript, so adding formatting like this is
difficult. I've experimented with a variety of code, but can't get the
effect I to work.

??

Setting the style of an html element is quite possible,
but first you would have to know CSS rather well.

Try:

<http://w3schools.com/css/default.asp>



Thanks, Everyone.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,577
Members
45,052
Latest member
LucyCarper

Latest Threads

Top