Results 1 to 9 of 9

Thread: Javascript wanted

  1. #1
    Join Date
    Apr 2007
    Posts
    59
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Default Javascript wanted

    I'm looking for a Javascript that makes the following: I have a list of questions with three answers each. I would like to have the following behaviour: on rollover the correct answer should change to green color. Somebody can gives me a good hint?

    Example:

    Question 1: how much is 2+3?
    a) the correct answer is 6
    b) the correct answer is 5 On rollover to the question "b) the correct answer is 5" should change to green
    c) the correct answer is 4

  2. #2
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    3,033
    Thanks
    25
    Thanked 599 Times in 575 Posts
    Blog Entries
    40

    Default

    You can do this with the pseudo class :hover in CSS http://www.tizag.com/cssT/pclass.php

    Please try to use a more description title for your post in future. Just saying 'JavaScript wanted' isn't a very accurate indicator if what your query is about and many people will choose to ignore it.
    Focus on Function Web Design
    Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps

  3. #3
    Join Date
    May 2012
    Location
    Hitchhiking the Galaxy
    Posts
    1,013
    Thanks
    46
    Thanked 139 Times in 139 Posts
    Blog Entries
    1

    Default

    Take a look here under css styling for mootools.
    "Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program." - Linus Torvalds
    Anime Views Forums
    Bernie

  4. #4
    Join Date
    Apr 2007
    Posts
    59
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Beverleyh View Post
    You can do this with the pseudo class :hover in CSS http://www.tizag.com/cssT/pclass.php
    The suggestion that you mention changes the color of the question, not of one of the answer. I thing I have to develop a Javascript with getElementById

  5. #5
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    3,033
    Thanks
    25
    Thanked 599 Times in 575 Posts
    Blog Entries
    40

    Default

    It (hover pseudo class) will effect whatever you target, but you need to define that in your CSS. Target the correct answer and not the question - wrap a span around it with a class, and target that in your CSS. You'll then be able to reuse the class on all the other corrects answers.
    Last edited by Beverleyh; 11-18-2012 at 09:53 PM. Reason: Grammar
    Focus on Function Web Design
    Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps

  6. #6
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    3,033
    Thanks
    25
    Thanked 599 Times in 575 Posts
    Blog Entries
    40

    Default

    If you need more specific help, please post a link to your page
    Focus on Function Web Design
    Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps

  7. #7
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Two things to add:
    1. The hover method works in all browsers except earlier versions of Internet Explorer, in which it works only for <a> tags (links). Can someone confirm for me that it works in the latest versions of IE such as IE 8 and 9? I think so, but I'm not 100% sure on that.

    2. Why do you want to give away the answer like this? I'm just checking to be sure this is the right way to approach it. I can imagine this might be a method of stopping bots from accessing the site (they can't read/understand well enough to do the math) as a sort of CAPTCHA. But if you include some kind of indication in the code (eg, a special CSS property), the bots will learn to figure that out, so it's actually problematic to do it that way.
    If this is for unrelated reasons, it's probably fine. But I thought I'd check in on that.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  8. #8
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    3,033
    Thanks
    25
    Thanked 599 Times in 575 Posts
    Blog Entries
    40

    Default

    Yes, IE7, 8 and 9 play nicely with :hover on all elements
    Focus on Function Web Design
    Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps

  9. #9
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Ah, so it's just IE6 and below. Good to know. Those browsers can be more or less safely ignored at this point. Thanks.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

Similar Threads

  1. Wanted: Javascript / Google Analytics person
    By daxtrajero in forum General Paid Work Requests
    Replies: 0
    Last Post: 05-09-2011, 09:02 PM
  2. Help wanted for CMS
    By 4dWeb in forum Looking for such a script or service
    Replies: 9
    Last Post: 10-14-2007, 11:42 PM
  3. Something I've always wanted to know
    By Jack in forum The lounge
    Replies: 4
    Last Post: 07-24-2006, 02:34 PM
  4. WANTED: Javascript professionals!
    By bajiggity08 in forum JavaScript
    Replies: 2
    Last Post: 01-16-2006, 10:34 PM
  5. Wanted!
    By ausant in forum The lounge
    Replies: 2
    Last Post: 12-15-2004, 12:13 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •