1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

trouble with javascript

Discussion in 'Web Design & Development' started by transcriptionist, Nov 11, 2007.

Thread Status:
Not open for further replies.
Advertisement
  1. transcriptionist

    transcriptionist Thread Starter

    Joined:
    May 26, 2001
    Messages:
    309
    I am taking a beginner web design class and this week's tutorial is on javascript. The assignment is to change the color of the scrollbar. I am having a heck of a time getting this to work. I am using Alleycode and here is my code - according to the book...

    "<script type="text/javascript">
    <!--Hide from old browsers
    function scrollColor() {
    document.body.style.scrollbarFaceColor="#3300ff"
    document.body.style.scrollbarTrackColor="#3399ff"
    }

    //-->
    </script>"

    The beginning quotations and ending quotations are not in my code. Later in the BODY section I have onload="scrollColor()"

    Can someone tell me why this wont work? I have spent almost the entire day searching for variations in this and I can't seem to find anything that works!

    ((I posted this in the Development forum as well))
     
  2. Fyzbo

    Fyzbo

    Joined:
    Feb 6, 2002
    Messages:
    1,683
    The code works fine in IE. Just a pointer you should add semi-colons to the end of the statements.

    function scrollColor() {
    document.body.style.scrollbarFaceColor="#3300ff";
    document.body.style.scrollbarTrackColor="#3399ff";
    };

    This code will not work in other browsers as they do not support changing the color of the scrollbars. Why would you want to change the color of the scroll bar?
     
  3. transcriptionist

    transcriptionist Thread Starter

    Joined:
    May 26, 2001
    Messages:
    309
    thank you Fyzbo - I will try that as soon as I get home from work. It is our homework assignment to make the scrollbar change color...everyone in class is having a hard time with this.
     
  4. Fyzbo

    Fyzbo

    Joined:
    Feb 6, 2002
    Messages:
    1,683
    Well your code works, even if I don't understand the assignment.

    Seems like styles belong in a css file, not javascript.

    Good luck in your class.
     
  5. MMJ

    MMJ Guest

    Joined:
    Oct 15, 2006
    Messages:
    3,625
    http://www.w3.org/Style/Examples/007/scrollbars:

     
  6. transcriptionist

    transcriptionist Thread Starter

    Joined:
    May 26, 2001
    Messages:
    309
    thank you Fyzbo!

    MMJ - this may be a 'green' question but who are the Net Police? Who governs what is legal and what isn't - and who enforces? I guess I am a little baffled at that comment because you see porn plastered all over the net yet it is claimed to be 'illegal' to change a scrollbar color?
     
  7. MMJ

    MMJ Guest

    Joined:
    Oct 15, 2006
    Messages:
    3,625
    The World Wide Web Consortium are the people responsible for the pretty much all the web standards.

    http://www.w3.org/Consortium/:

     
  8. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/650726

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice