PDA

View Full Version : Style Sheet Switcher Problems



oppeneer
10-11-2008, 12:47 AM
1) Script Title: Style Sheet Switcher

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex9/stylesheetswitcher.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

rangana
10-11-2008, 01:55 AM
Try to change $DOC_ROOT to test only.

If nothing works, please provide a link to the page in question.

oppeneer
10-11-2008, 10:53 AM
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

rangana
10-12-2008, 02:56 AM
You are pointing to a file that is not in your folder:


<script src="/test/javascript/styleswitch.js" type="text/javascript"></script>


Which does'nt exist: http://www.hotdatingplanet.eu/test/test/javascript/styleswitch.js

Instead, it should be:


<script src="javascript/styleswitch.js" type="text/javascript"></script>


Which exist: http://www.hotdatingplanet.eu/test/javascript/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:


<script src="{$DOC_ROOT}javascript/styleswitch.js" type="text/javascript"></script>


Hope that helps.

oppeneer
10-12-2008, 03:47 PM
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

rangana
10-13-2008, 07:25 AM
Remove highlighted:


<script type="text/javascript" src="{$DOC_ROOT}javascript/styleswitch.js"></script>