Results 1 to 6 of 6

Thread: Style Sheet Switcher Problems

  1. #1
    Join Date
    Oct 2008
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Style Sheet Switcher Problems

    1) Script Title: Style Sheet Switcher

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...etswitcher.htm

    3) Describe problem:

    Hi,
    I can't figure out how to get this script working

    I uploaded in /test/javascript the javascript file

    I am using an index.php
    I added the following for the javascript:
    <script src="{$DOC_ROOT}javascript/styleswitch.js" type="text/javascript"></script>

    ="{$DOC_ROOT} (refers to /test)


    <link rel="stylesheet" type="text/css" href="{$css_path}default.css" />
    <link rel="alternate stylesheet" type="text/css" media="screen" title="blue-theme" href="{$css_path}defaultblue.css" />

    {$css_path} (= /test/templates/default)

    Here is the default.css loaded and uploaded the defaulblue.css in the same directory.

    added to index.php

    <form id="switchform">
    <select name="switchcontrol" size="1" onChange="chooseStyle(this.options[this.selectedIndex].value, 60)">
    <option value="none" selected="selected">Default style</option>
    <option value="blue-theme">Blue Theme</option>
    </select>
    </form>

    the form shows but doesn't do anything.

    tried also these lines the show but no results either (except a headache:-)
    <a href="javascript:chooseStyle('none', 60)" checked="checked">Default style</a>
    <a href="javascript:chooseStyle('blue-theme', 60)">Blue theme</a>

    <script type="text/javascript">
    window.onload=function(){
    var formref=document.getElementById("switchform")
    indicateSelected(formref.choice)
    }
    </script>

    What do I have to do to make this code work for me? Preferable with a select menu as the interface.

    Thanks in advance,

    Jan

  2. #2
    Join Date
    Feb 2008
    Location
    Cebu City Philippines
    Posts
    1,160
    Thanks
    17
    Thanked 277 Times in 275 Posts

    Default

    Try to change $DOC_ROOT to test only.

    If nothing works, please provide a link to the page in question.
    Learn how to code at 02geek

    The more you learn, the more you'll realize there's much more to learn
    Ray.ph!

  3. #3
    Join Date
    Oct 2008
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hi,

    Didn't work this is the link to my page.

    http://www.hotdatingplanet.eu/test/index.php


    attached you find a zip file containing the index.php

  4. #4
    Join Date
    Feb 2008
    Location
    Cebu City Philippines
    Posts
    1,160
    Thanks
    17
    Thanked 277 Times in 275 Posts

    Default

    You are pointing to a file that is not in your folder:
    Code:
    <script src="/test/javascript/styleswitch.js" type="text/javascript"></script>
    Which does'nt exist: http://www.hotdatingplanet.eu/test/t...styleswitch.js

    Instead, it should be:
    Code:
    <script src="javascript/styleswitch.js" type="text/javascript"></script>
    Which exist: http://www.hotdatingplanet.eu/test/j...styleswitch.js

    This means, that in your PHP file (I haven't downloaded your zipped file though).

    You should change the location to depict that of the correct one.

    If this is the way you do it, then removing highlighted might help:
    Code:
    <script src="{$DOC_ROOT}javascript/styleswitch.js" type="text/javascript"></script>
    Hope that helps.
    Learn how to code at 02geek

    The more you learn, the more you'll realize there's much more to learn
    Ray.ph!

  5. #5
    Join Date
    Oct 2008
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    No that doesn't make a difference

    </script>
    <link href="{$css_path}menu.css" rel="stylesheet" type="text/css" />
    <link href="{$css_path}solidblockmenu.css" rel="stylesheet" type="text/css" />
    <link rel="stylesheet" type="text/css" href="{$css_path}default.css" />
    <link rel="alternate stylesheet" type="text/css" media="screen" title="blue-theme" href="{$css_path}defaultblue.css" />
    {$addtional_css}

    <script type="text/javascript" src="{$DOC_ROOT}javascript/menu.js"></script>
    <script type="text/javascript" src="{$DOC_ROOT}javascript/functions.js"></script>
    <script type="text/javascript" src="{$DOC_ROOT}javascript/check.js"></script>
    <script type="text/javascript" src="{$DOC_ROOT}javascript/validate.js"></script>
    <script type="text/javascript" src="{$DOC_ROOT}javascript/editor.js"></script>
    <script type="text/javascript" src="{$DOC_ROOT}javascript/ddaccordion.js"></script>
    <script type="text/javascript" src="{$DOC_ROOT}javascript/ddaccordioninit.js"></script>
    <script type="text/javascript" src="{$DOC_ROOT}javascript/jquery-1.2.6.pack.js"></script>
    <script type="text/javascript" src="{$DOC_ROOT}javascript/styleswitch.js"></script>

    The files on the server:

    /public_html/test/javascript = In this map i have all the javascripts. All of them are working fine with above configuration in index.php

    the css files are in /public_html/test/templates/default
    and the alternate file is in /public_html/test/templates/default-blue

    I added these lines in index.php like this:
    </head>
    <body dir="{lang mkey='DIRECTION'}" {if $google_map eq 'Y'}onload="load_map()"{/if}>

    <form id="switchform">
    <select name="switchcontrol" size="1" onChange="chooseStyle(this.options[this.selectedIndex].value, 60)">
    <option value="none" selected="selected">Default style</option>
    <option value="blue-theme">Blue Theme</option>
    <option value="brown-theme">Brown Theme</option>
    </select>
    </form>

    saved this and uploaded it to the server in /public_html/test/templates/default

    the difference between the css files are the background color make up. All other things stay the same. Didn't make any changes to the provided programming or javascript. (probably I should but don't know how)

    Kind regards,
    Jan

  6. #6
    Join Date
    Feb 2008
    Location
    Cebu City Philippines
    Posts
    1,160
    Thanks
    17
    Thanked 277 Times in 275 Posts

    Default

    Remove highlighted:
    Code:
    <script type="text/javascript" src="{$DOC_ROOT}javascript/styleswitch.js"></script>
    Learn how to code at 02geek

    The more you learn, the more you'll realize there's much more to learn
    Ray.ph!

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
  •