Applying CSS Styles to Javascript Rollovers

Discussion in 'Javascript' started by Dinsdale, Jan 19, 2007.

  1. Dinsdale

    Dinsdale Guest

    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!
     
    Dinsdale, Jan 19, 2007
    #1
    1. Advertising

  2. Dinsdale

    Evertjan. Guest

    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.

    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)
     
    Evertjan., Jan 19, 2007
    #2
    1. Advertising

  3. Dinsdale

    Dinsdale Guest

    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.






    Evertjan. wrote:
    > 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.
    >
    > --
    > Evertjan.
    > The Netherlands.
    > (Please change the x'es to dots in my emailaddress)
     
    Dinsdale, Jan 19, 2007
    #3
  4. Dinsdale

    ASM Guest

    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>

    --
    Stephane Moriaux et son (moins) vieux Mac déjà dépassé
    Stephane Moriaux and his (less) old Mac already out of date
     
    ASM, Jan 19, 2007
    #4
  5. Dinsdale

    Evertjan. Guest

    Dinsdale wrote on 19 jan 2007 in comp.lang.javascript:
    > Evertjan. wrote:
    >> 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.


    [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>

    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)
     
    Evertjan., Jan 19, 2007
    #5
  6. Dinsdale

    Dinsdale Guest

    Evertjan. wrote:
    > Dinsdale wrote on 19 jan 2007 in comp.lang.javascript:
    > > Evertjan. wrote:
    > >> 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.

    >
    > [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>
    >
    > --
    > Evertjan.
    > The Netherlands.
    > (Please change the x'es to dots in my emailaddress)




    Thanks, Everyone.
     
    Dinsdale, Jan 19, 2007
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. sasquatch
    Replies:
    0
    Views:
    458
    sasquatch
    Nov 20, 2005
  2. sasquatch
    Replies:
    7
    Views:
    14,495
    Juan T. Llibre
    Nov 21, 2005
  3. =?Utf-8?B?TmVpbCBTdGV2ZW50b24=?=

    Applying CSS Styles to Dropdownlist

    =?Utf-8?B?TmVpbCBTdGV2ZW50b24=?=, May 15, 2006, in forum: ASP .Net
    Replies:
    4
    Views:
    61,130
    Juan T. Llibre
    May 15, 2006
  4. DalePres

    Applying styles from multiple sources

    DalePres, Jun 26, 2004, in forum: ASP .Net Building Controls
    Replies:
    4
    Views:
    203
    DalePres
    Jul 2, 2004
  5. DalePres

    Applying styles from multiple sources

    DalePres, Jun 26, 2004, in forum: ASP .Net Web Controls
    Replies:
    5
    Views:
    224
    DalePres
    Jul 2, 2004
Loading...

Share This Page