Reviews, updates and in depth guides to your favourite mobile games - AppGamer.com
|
|
CSS rotator thingy - problem |
Page: 1 | Reply |
May 12th 2006 | #172731 Report |
Member since: Feb 7th 2002 Posts: 1564 |
Problem I have... A js thingy that is supposed to make it possible to change colors on a site by changing the CSS files. But as I had this incorporated at my site as a test I noticed today (as I for the first time checked it in IE, didn't do that last night for some reason) that IE is somewhat confused, hehe...It uses both my test CSS's at the same time... Is there anyone willing and knowledgable enough to see if something can be done to this IE feckup ??? Done this: Open up a blank file in your favorite text editor and fill it up with the following and name it cookies.common.js: [code]/** * Sets a Cookie with the given name and value. * * name Name of the cookie * value Value of the cookie * [expires] Expiration date of the cookie (default: end of current session) * [path] Path where the cookie is valid (default: path of calling document) * [domain] Domain where the cookie is valid * (default: domain of calling document) * [secure] Boolean value indicating if the cookie transmission requires a * secure transmission */ function setCookie(name, value, domain, expires, path, secure) { document.cookie = name + "=" + escape(value) + ((expires) ? "; expires=" + expires.toGMTString() : "") + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + ((secure) ? "; secure" : ""); } /** * Gets the value of the specified cookie. * * name Name of the desired cookie. * * Returns a string containing value of specified cookie, * or null if cookie does not exist. */ 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 null; } else { begin += 2; } var end = document.cookie.indexOf(";", begin); if (end == -1) { end = dc.length; } return unescape(dc.substring(begin + prefix.length, end)); }[/code] Edit your header with whatever CSS files you need: [HTML] [/HTML] Enter this js in the header: [HTML] [/HTML] And also call upon the cookie.common.js, which you obviously have uploaded to your server, by adding this in the header: [HTML] [/code] And finally put in the code, somewhere on your site, to make it possible for viewers to actually change to code: [code]Green perhaps Might be red Or possibly blue[/HTML] And may I add: I have not wrote this if anybody should think so, hehe Yea, right ;). I searched the web sometime ago and found this, and since then it's been hiding deep down on my server just to be discovered today, and I thought I'd share it with you lot. I have put it up on my site but not yet costumized other CSS files, which shall be done in due time...Perhaps this weekend, yea... A bottle of beer or two and CSS costumization, that sounds like a blast ;) Patric. |
Reply with Quote Reply |
Jun 4th 2006 | #173164 Report |
Member since: Mar 20th 2001 Posts: 3367 |
You'd have some problem with that if someone disabled javascript but a maybe server side scripting would do a better job since it'll only involve setting the cookie? You just need to let the user select the style, let php set the cookie and select the appropriate style based on the cookie on the subsequent visits. Might be less coding too ;) I did this with site templates quite sometime ago |
Reply with Quote Reply |
Jun 4th 2006 | #173167 Report |
Member since: Feb 7th 2002 Posts: 1564 |
Care to share a link ?
|
Reply with Quote Reply |
Jun 5th 2006 | #173183 Report |
Member since: Mar 20th 2001 Posts: 3367 |
|
Reply with Quote Reply |
Jun 5th 2006 | #173185 Report |
Member since: Feb 7th 2002 Posts: 1564 |
Thanks, mate.
|
Reply with Quote Reply |
Page: 1 | Back to top |
Please login or register above to post in this forum |
© Web Media Network Limited. All rights reserved. No part of this website may be reproduced without written permission. Photoshop is a registered trademark of Adobe Inc.. TeamPhotoshop.com is not associated in any way with Adobe, nor is an offical Photoshop website. |