Advertise Here

Author Topic: [[HELP]] Change style changer to HTML  (Read 3326 times)

0 Members and 1 Guest are viewing this topic.

Offline Seldom Fail

  • Helpers
  • *
  • Posts: 2082
  • Helping for 3 years! :)
    • View Profile
    • My Site!

  • Total Badges: 26
    Badges: (View All)
    Sixth year Anniversary Fifth year Anniversary Apple User Search Poll Voter
[[HELP]] Change style changer to HTML
« on: April 10, 2009, 08:29:29 pm »
K... So I got the style chooser code in HTML but now the button won't change it. Here's the code I used.

Code: [Select]
<script>
var n = 0;var Skin = new Array();
Skin[n++] = ["Default Blue","http://www.smfforfree.com/styles/sitecreator/default.css?fin11"];
Skin[n++] = ["Blue","http://www.smfforfree.com/styles/nonstopgamers/red.css?fin11"];
Skin[n++] = ["Green","http://www.smfforfree.com/styles/sitecreator/green.css?fin11"];
Skin[n++] = ["Helios Red","http://www.smfforfree.com/styles/sitecreator/heliosred.css?fin11"];
Skin[n++] = ["Red","http://www.smfforfree.com/styles/sitecreator/red.css?fin11"];
Skin[n++] = ["Black","http://www.smfforfree.com/styles/sitecreator/black.css?fin11"];

//Created by Jaron (based on Agent Moose's original)
document.write("<center><select id='SkinChooser'><option value='default'>Choose Style</option>");
for(i=0;i<Skin.length;i++){
document.write("<option value='" + Skin[i][1] + "'>" + Skin[i][0] + "</option>");
};
document.write("</select><button onclick='setSkin();'>Change</button></center>");
function setCookie(name, value, expires){
var deCookie = name + "=" + escape(value);
if(expires){
expires= expires.toGMTString();
deCookie += "; expires=";
deCookie += expires;
};
document.cookie = deCookie;
};
function getCookie(name){
var dc = document.cookie;
var prefix = name + "=";
var begin = dc.indexOf("; " + prefix);
if (begin == -1){
begin = dc.indexOf(prefix);
if (begin != 0) return false;
}else begin += 2;
var end = document.cookie.indexOf(";", begin);
if (end == -1)
end = dc.length;
return unescape(dc.substring(begin + prefix.length, end));
};
function delCookie(name){
expires = new Date(1807,1,1);
expires = expires.toGMTString();
deCookie = name;
deCookie += "=delete; expires=";
deCookie += expires;
document.cookie = deCookie;
};
function changeSkin(Agent){
document.write("<link rel='stylesheet' type='text/css' href='" + Agent + "' />");
};
var Omi = "default";
document.getElementById("SkinChooser").onchange = function(){
if(Skin[parseInt(document.getElementById("SkinChooser").selectedIndex)-1]){
Omi = Skin[parseInt(document.getElementById("SkinChooser").selectedIndex)-1][1]
}else{
Omi = "default";
};};
function setSkin(){
if(Omi == "default") delCookie("Skin");
if(Omi != "default") setCookie("Skin",Omi,new Date(9999,1,1));
window.location.reload();
};
changeSkin(getCookie("Skin"));
</script>
<--- Donate to SMF For Free! :D

Offline Colette Brunel

  • SMF For Free Sr. Member
  • *
  • Posts: 424
    • View Profile

  • Total Badges: 17
    Badges: (View All)
    Poll Voter Level 4 Fourth year Anniversary Windows User Topic Starter
Re: [[HELP]] Change style changer to HTML
« Reply #1 on: April 10, 2009, 10:00:07 pm »
.....

Code: [Select]
<div style="margin: -1.7em 0.5em 0.5em; float: right;">
Style:&nbsp;
<select onchange="location='http://yoursite.smfforfree.com/?theme=' + this.options[this.selectedIndex].value">
<option value="1" selected="selected">Default</option>
<option value="2">Something else...</option>
</select>
</div>

Replace each value with the theme's ID. :/

Offline Seldom Fail

  • Helpers
  • *
  • Posts: 2082
  • Helping for 3 years! :)
    • View Profile
    • My Site!

  • Total Badges: 26
    Badges: (View All)
    Sixth year Anniversary Fifth year Anniversary Apple User Search Poll Voter
Re: [[HELP]] Change style changer to HTML
« Reply #2 on: April 28, 2009, 07:17:34 pm »
How do I find the theme ID?
<--- Donate to SMF For Free! :D

Offline Seldom Fail

  • Helpers
  • *
  • Posts: 2082
  • Helping for 3 years! :)
    • View Profile
    • My Site!

  • Total Badges: 26
    Badges: (View All)
    Sixth year Anniversary Fifth year Anniversary Apple User Search Poll Voter
Re: [[HELP]] Change style changer to HTML
« Reply #3 on: April 30, 2009, 04:50:48 pm »
Still need this code ;)
<--- Donate to SMF For Free! :D

Offline Seldom Fail

  • Helpers
  • *
  • Posts: 2082
  • Helping for 3 years! :)
    • View Profile
    • My Site!

  • Total Badges: 26
    Badges: (View All)
    Sixth year Anniversary Fifth year Anniversary Apple User Search Poll Voter
Re: [[HELP]] Change style changer to HTML
« Reply #4 on: May 03, 2009, 09:17:38 pm »
Ok all I need to know is where to find the theme ID at!

Thanks,
Jaron
<--- Donate to SMF For Free! :D

Offline simply sibyl

  • Helpers
  • *
  • Posts: 14347
  • On hiatus
    • View Profile
    • The Tent Dwellers

  • Total Badges: 31
    Badges: (View All)
    Level 6 Poll Voter Webmaster Arcade Highscore Windows User
Re: [[HELP]] Change style changer to HTML
« Reply #5 on: May 03, 2009, 10:19:09 pm »
Ok all I need to know is where to find the theme ID at!

Thanks,
Jaron

I believe where it says  value="1"  you would replace the 1 with the name of the theme (the name you named it when you created it)    The first one would be the default theme.     (actually the name of the style as they are not themes they are styles)  Ive tried to get that code to work and have had no luck with it though Jaron.   
« Last Edit: May 03, 2009, 10:23:58 pm by simply sibyl »

 

Related Topics

  Subject / Started by Replies Last post
1 Replies
2082 Views
Last post May 01, 2008, 10:55:56 pm
by simply sibyl
1 Replies
10073 Views
Last post July 03, 2008, 07:51:18 pm
by Kalphiter
3 Replies
1176 Views
Last post July 18, 2008, 03:01:41 am
by simply sibyl
4 Replies
2490 Views
Last post July 13, 2011, 09:44:10 pm
by Spirit Goddess
1 Replies
9810 Views
Last post September 12, 2015, 04:55:23 pm
by SMF For Free