Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Community Discussions (All other subjects)
 "skins" with CSS / Javascript
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

sr_erick
Senior Member

USA
1318 Posts

Posted - 10 August 2004 :  22:51:29  Show Profile  Visit sr_erick's Homepage  Send sr_erick a Yahoo! Message
Is there any way to store an image path or location in CSS? I'd like to create a javascript link to swap color themes and also swap out images by swapping out the CSS file that I use. Any tips on how I could go about this?? Thanks!




Erick
Snowmobile Fanatics

D3mon
Senior Member

United Kingdom
1685 Posts

Posted - 11 August 2004 :  04:16:29  Show Profile  Visit D3mon's Homepage
You could use ASP to dynamically write the CSS source path like:

<style type="css/text">
@import url("<%= strCurrentStyle %>")
</style>


Snitz 'Speedball' : Site Integration Mod : Friendly Registration Mod
"In war, the victorious strategist only seeks battle after the victory has been won"
Go to Top of Page

redbrad0
Advanced Member

USA
3725 Posts

Posted - 13 August 2004 :  23:22:04  Show Profile  Visit redbrad0's Homepage  Send redbrad0 an AOL message
What is the import url? Does it import a new CSS file, do you specify the CSS file in the import url?

Brad
Oklahoma City Online Entertainment Guide
Oklahoma Event Tickets
Go to Top of Page

aspwiz
Junior Member

250 Posts

Posted - 14 August 2004 :  03:59:50  Show Profile  Visit aspwiz's Homepage
Hi....

If you are running speedball 2, then this will be made much easier for you....

I have skinning available on my site (although, I have not skinned icons)
Go to Top of Page

D3mon
Senior Member

United Kingdom
1685 Posts

Posted - 14 August 2004 :  05:47:30  Show Profile  Visit D3mon's Homepage
quote:
Originally posted by redbrad0

What is the import url? Does it import a new CSS file, do you specify the CSS file in the import url?

strCurrentstyle might be "../styles/style1.css" for example


Snitz 'Speedball' : Site Integration Mod : Friendly Registration Mod
"In war, the victorious strategist only seeks battle after the victory has been won"
Go to Top of Page

redbrad0
Advanced Member

USA
3725 Posts

Posted - 14 August 2004 :  15:48:42  Show Profile  Visit redbrad0's Homepage  Send redbrad0 an AOL message
So what is the difference in using importURL instread of ...

<link rel="stylesheet" type="text/css" href="<%= strCurrentStyle %>">

I think what erick would like to do is where they can click a icon and it changes all the images and everything without having to reload the page.

Brad
Oklahoma City Online Entertainment Guide
Oklahoma Event Tickets
Go to Top of Page

stuF
Average Member

United Kingdom
561 Posts

Posted - 14 August 2004 :  15:57:09  Show Profile  Visit stuF's Homepage
Well, if the images are decorational only, and as such are set as bg elements, they can be defined in each different CSS file.

If however you want to drag different images into the site which are not suitable to be part of the BG, you'll have to do something different.

Couldnt you just use this for image locations:

<img src="<%= strCurrentStyle %>/logo.gif">

and then use the same technique for setting the active stylsheet. You'd just have to name the image folders the same as the name of the stylesheet.

http://36-degrees.co.uk
Go to Top of Page

D3mon
Senior Member

United Kingdom
1685 Posts

Posted - 14 August 2004 :  16:20:08  Show Profile  Visit D3mon's Homepage
quote:
Originally posted by redbrad0

So what is the difference in using importURL instread of ...

<link rel="stylesheet" type="text/css" href="<%= strCurrentStyle %>">

I think what erick would like to do is where they can click a icon and it changes all the images and everything without having to reload the page.


They are pretty much the same except older non-CSS capable browsers, wont try to use the css file if it is @imported


Snitz 'Speedball' : Site Integration Mod : Friendly Registration Mod
"In war, the victorious strategist only seeks battle after the victory has been won"
Go to Top of Page

redbrad0
Advanced Member

USA
3725 Posts

Posted - 14 August 2004 :  19:18:56  Show Profile  Visit redbrad0's Homepage  Send redbrad0 an AOL message
A site that does this is http://www.face2meet.co.uk which the color changer is in flash so not sure how they change all the images.

Brad
Oklahoma City Online Entertainment Guide
Oklahoma Event Tickets
Go to Top of Page

Steve D.
Average Member

USA
640 Posts

Posted - 15 August 2004 :  00:12:43  Show Profile  Visit Steve D.'s Homepage  Send Steve D. a Yahoo! Message
quote:
Originally posted by redbrad0

A site that does this is http://www.face2meet.co.uk which the color changer is in flash so not sure how they change all the images.




This is the javascript function they use to switch the themes...

function changeTheme(newTheme)
{
  var pattern = /images\/themes\/\d{1,1}/ig;
  document.body.innerHTML = document.body.innerHTML.replace(pattern,"images/themes/"+newTheme);
  document.getElementById("customStyle").href='images/themes/'+newTheme+'/style.css';
  createCookie("theme", newTheme,365);
}

Swing Dancing Video Clips - It's All Swing! Forum
Go to Top of Page

redbrad0
Advanced Member

USA
3725 Posts

Posted - 15 August 2004 :  02:53:11  Show Profile  Visit redbrad0's Homepage  Send redbrad0 an AOL message
So it looks like the below html will replace all images in the html with the location specified. Pretty nice Thanks Steve

document.body.innerHTML = document.body.innerHTML.replace(pattern,"images/themes/"+newTheme);

Brad
Oklahoma City Online Entertainment Guide
Oklahoma Event Tickets
Go to Top of Page

Steve D.
Average Member

USA
640 Posts

Posted - 15 August 2004 :  13:31:24  Show Profile  Visit Steve D.'s Homepage  Send Steve D. a Yahoo! Message
No problem, I'm good at snooping, not coding

Swing Dancing Video Clips - It's All Swing! Forum
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.46 seconds. Powered By: Snitz Forums 2000 Version 3.4.07