Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 4 of 4
  1. #1
    Junior Member
    Join Date
    Mar 2004
    Location
    Durham, NC, US
    Posts
    17
    Member #
    5090
    I have a link bar in a simple application interface. It is a solid color block with a few inline links. On this particular page, the links don't load a page, but fire scripts to shuffle the display on a few text blocks. The links are working, and you can select 'Mine' to see your table, 'Group' to see the group's table, and 'Complete' to see the completed table. All three tables are generated when the page loads, but with the scripting, only one is visible at a time.

    That isn't a problem. My problem is, the links have a hover style set in the style sheet. By default, the links are white on navy. If you hover, they are navy on a light blue-gray. If you select it, I have the script setting the color to navy on white.

    If you select 'Mine', then the 'Mine' link will change color. The script sets the color of each of the other links to make sure only one has the inverse, selected colors.

    The problem is, the hover style no longer works.

    Without putting more scripting in, is there a way to preserve the hover effects? Is there a way to set the color of the selected link without scripting, or perhaps with scripting, but having it call on values from the stylesheet to avoid hardcoding the colors? I tried changing the class, but there is no change in the colors.

  2.  

  3. #2
    Senior Member glyakk's Avatar
    Join Date
    Nov 2003
    Location
    USA
    Posts
    1,263
    Member #
    3828
    Liked
    6 times
    I was following you until after the third paragraph.. Im not quite understanding what you mean. In some instances when you say 'scripts' are you reffering css rules? Could you provide a link? or pieces of your source that you are reffering to specificly.


  4. #3
    Junior Member
    Join Date
    Mar 2004
    Location
    Durham, NC, US
    Posts
    17
    Member #
    5090
    A very crude example:
    Code:
    <span id="myFirstSpan" class="mySpanClass" onclick="javascript:myFunction(this);">My Span Text</span>
    <span id="mySecondSpan" class="mySpanClass" onclick="javascript:myFunction(this);">My Other Span Text</span>
    The style rules established by .mySpanClass set the background color to navy, the font color to white, and a hover effect that changes the background color to blue. This works fine.

    The JavaScript function myFunction() will change the background color of the span that triggers the function to white, and the font color to navy. It will also change the colors of the span that did not trigger the function, setting them to the original white on navy. This works fine, and you can select either one, multiple times and see the colors change.

    But after the JavaScript function fires once, the hover CSS rules no longer apply. Without adding another JavaScript (onmousein/out), is it possible to keep the hover effect? Is it also possible that the JavaScript can change the appearance of these inline blocks of text without explicitly knowing what the color values should be? In other words, can I keep the style seperate from the code, and possibly have the code call on the style sheet? I tried to have the scripting change the class attribute, but that didn't have any affect.

  5. #4
    Senior Member teal's Avatar
    Join Date
    Dec 2003
    Posts
    247
    Member #
    4319
    It would seem that you need an onmouseout to undo the script once the little curser left, but I don't know javascript, so don't take my word on it . . .
    Whoth steps forth to mock the teal? Whom couldst say a color superior!

    Proclamith me, it cannot be done.


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 06:04 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com