www.webdeveloper.com
Results 1 to 4 of 4

Thread: Mouse click text change

  1. #1
    Join Date
    Nov 2007
    Posts
    1

    Mouse click text change

    Hi, all new here, if some one can help me I promis I will do my me best to help someone else.

    Basicly I need a code so when you click on a text it cahanges colours.

    Not very undestanding of html code so any sugestions as simple as possible.

    Cheers
    Owain

  2. #2
    Join Date
    May 2005
    Location
    Gold Coast (MS)
    Posts
    2,216
    Try:

    Code:
    <a href="http://_" onClick="document.getElementById('divIDName').style.color='#007878'">
    <span id="divIDName">Text Color Changes</span></a>
    Ron
    Last edited by Major Payne; 11-12-2007 at 12:15 AM.

  3. #3
    Join Date
    Nov 2007
    Posts
    21

    didn't work

    Ron,

    i tried that code and it didn't work. when i click the link it takes me
    to a blank url http://_/. don't u need to use javascript when using a document object? or any object at all?

  4. #4
    Join Date
    May 2005
    Location
    Gold Coast (MS)
    Posts
    2,216
    Worked fine for me in IE and FF. The text does change colors and it will take you to a blank URL. Try href="#" instead or use
    Code:
    <span id="divIDName" onClick="document.getElementById('divIDName').style.color='#ff00ff'">Click Me to Change My Color</span>
    which also worked for me in FF and IE.

    Ron
    Last edited by Major Payne; 11-12-2007 at 09:39 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles