Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript From this style to this style?

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #39183
    GregStevens
    Member

    Hey everybody.
    Javascript is a very weak point of mine, and I really can’t figure out how I can make a website with a style like this (http://jsfiddle.net/qRds9/) to this (http://jsfiddle.net/YgmYn/) with a click of a button.

    Basically, I need to know how I can make the style of a website change using the onclick function.

    Please let me know.

    #107269
    Johnnyb
    Member

    Best way to do it is to just add a class to the body and use CSS to change the style: http://jsfiddle.net/qRds9/2/

    #107359
    GregStevens
    Member

    Johnny, that’s good. I made this (http://jsfiddle.net/BmXNe/)

    but using your method you can only change the theme ONCE. then the links are rendered useless. And on the website I’m working on it’s not going to make the users very happy knowing they’d have to refresh every time they want to try a theme more than once.

    How do i make it so the links work infinitely?

    #107382

    Hi GregStevens,
    Here is a pretty straightforward way of accomplishing your task.

    http://jsfiddle.net/BmXNe/14/

    What you need to do is remove the other class when a new theme is clicked.

Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.