<?xml version="1.0" encoding="UTF-8"?><rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
> <channel><title>Comments on: Combined Style-Changer/Random Header</title> <atom:link href="http://www.elanman.co.uk/2009/03/combined-style-changerrandom-header/feed/" rel="self" type="application/rss+xml" /><link>http://www.elanman.co.uk/2009/03/combined-style-changerrandom-header/</link> <description>ElanMan&#039;s Code Snippets</description> <lastBuildDate>Wed, 18 Jan 2012 12:55:26 +0000</lastBuildDate> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <item><title>By: Fox</title><link>http://www.elanman.co.uk/2009/03/combined-style-changerrandom-header/comment-page-1/#comment-169</link> <dc:creator>Fox</dc:creator> <pubDate>Mon, 01 Feb 2010 22:13:46 +0000</pubDate> <guid
isPermaLink="false">http://www.elanman.co.uk/?p=366#comment-169</guid> <description>It&#039;s been 6 months and i still dont know how to do this style/header switcher thing. But thanks to all the people who tried to help.
Fox</description> <content:encoded><![CDATA[<p>It&#8217;s been 6 months and i still dont know how to do this style/header switcher thing. But thanks to all the people who tried to help.</p><p>Fox</p> ]]></content:encoded> </item> <item><title>By: Fox</title><link>http://www.elanman.co.uk/2009/03/combined-style-changerrandom-header/comment-page-1/#comment-115</link> <dc:creator>Fox</dc:creator> <pubDate>Wed, 19 Aug 2009 15:19:56 +0000</pubDate> <guid
isPermaLink="false">http://www.elanman.co.uk/?p=366#comment-115</guid> <description>Hi, any progress with that request of mine? I just cant seem to figure it out myself.
Fox</description> <content:encoded><![CDATA[<p>Hi, any progress with that request of mine? I just cant seem to figure it out myself.</p><p>Fox</p> ]]></content:encoded> </item> <item><title>By: ElanMan</title><link>http://www.elanman.co.uk/2009/03/combined-style-changerrandom-header/comment-page-1/#comment-108</link> <dc:creator>ElanMan</dc:creator> <pubDate>Fri, 17 Jul 2009 17:19:37 +0000</pubDate> <guid
isPermaLink="false">http://www.elanman.co.uk/?p=366#comment-108</guid> <description>Hi Fox,
I&#039;m not familiar with that script. I&#039;ll download it and take a look, see if I can help.</description> <content:encoded><![CDATA[<p>Hi Fox,<br
/> I&#8217;m not familiar with that script. I&#8217;ll download it and take a look, see if I can help.</p> ]]></content:encoded> </item> <item><title>By: Fox</title><link>http://www.elanman.co.uk/2009/03/combined-style-changerrandom-header/comment-page-1/#comment-104</link> <dc:creator>Fox</dc:creator> <pubDate>Sun, 12 Jul 2009 17:39:29 +0000</pubDate> <guid
isPermaLink="false">http://www.elanman.co.uk/?p=366#comment-104</guid> <description>Hi, i&#039;m using a style switcher from &lt;a href=&quot;http://www.dynamicdrive.com/dynamicindex9/stylesheetswitcher.htm&quot; rel=&quot;nofollow&quot;&gt;dynamic drive&lt;/a&gt;. I need to change my headers everytime my stylesheet changes, but not randomly. One style is called &quot;Flame on&quot;, so i need my flame header to show.
Thanks in advance.</description> <content:encoded><![CDATA[<p>Hi, i&#8217;m using a style switcher from <a
href="http://www.dynamicdrive.com/dynamicindex9/stylesheetswitcher.htm" rel="nofollow">dynamic drive</a>. I need to change my headers everytime my stylesheet changes, but not randomly. One style is called &#8220;Flame on&#8221;, so i need my flame header to show.</p><p>Thanks in advance.</p> ]]></content:encoded> </item> <item><title>By: BlueCougar</title><link>http://www.elanman.co.uk/2009/03/combined-style-changerrandom-header/comment-page-1/#comment-23</link> <dc:creator>BlueCougar</dc:creator> <pubDate>Sat, 14 Mar 2009 00:42:12 +0000</pubDate> <guid
isPermaLink="false">http://www.elanman.co.uk/?p=366#comment-23</guid> <description>Oh wow I just realized that my scripts code snip didn&#039;t show up in my last comment, sorry.
Anyway, I fixed the code to be just like you said, all the titles are uppercase and the images don&#039;t include folder names.
But still no luck, it&#039;s the same as before. The header image(s) won&#039;t show, and the style switcher won&#039;t work.
This is the test page I&#039;m seting it up on if you want to see,
[ http://www.freewebs.com/bluecougarstudio/newlayout.html ]</description> <content:encoded><![CDATA[<p>Oh wow I just realized that my scripts code snip didn&#8217;t show up in my last comment, sorry.<br
/> Anyway, I fixed the code to be just like you said, all the titles are uppercase and the images don&#8217;t include folder names.<br
/> But still no luck, it&#8217;s the same as before. The header image(s) won&#8217;t show, and the style switcher won&#8217;t work.<br
/> This is the test page I&#8217;m seting it up on if you want to see,<br
/> [ <a
href="http://www.freewebs.com/bluecougarstudio/newlayout.html" rel="nofollow">http://www.freewebs.com/bluecougarstudio/newlayout.html</a> ]</p> ]]></content:encoded> </item> <item><title>By: ElanMan</title><link>http://www.elanman.co.uk/2009/03/combined-style-changerrandom-header/comment-page-1/#comment-22</link> <dc:creator>ElanMan</dc:creator> <pubDate>Wed, 11 Mar 2009 09:45:00 +0000</pubDate> <guid
isPermaLink="false">http://www.elanman.co.uk/?p=366#comment-22</guid> <description>Hi, try changing your RandImg() function to the modified one in my last comment.
Notice that the array &#039;pictures&#039; doesn&#039;t include the folder names, just the image names.
The folder names are dynamically created to be the same as the &#039;title&#039; attributes for the stylesheets. So, if your title is &#039;lightson&#039;, the RandImg() function searches for images in the /lightson folder. At the moment, I notice that your titles are in lowercase i.e. &#039;lightson&#039; but your folder names use uppercase i.e. &#039;LightsOn&#039;. This won&#039;t work so change your folder names to lowercase too.
Once again, let me know how you get on.</description> <content:encoded><![CDATA[<p>Hi, try changing your RandImg() function to the modified one in my last comment.<br
/> Notice that the array &#8216;pictures&#8217; doesn&#8217;t include the folder names, just the image names.<br
/> The folder names are dynamically created to be the same as the &#8216;title&#8217; attributes for the stylesheets. So, if your title is &#8216;lightson&#8217;, the RandImg() function searches for images in the /lightson folder. At the moment, I notice that your titles are in lowercase i.e. &#8216;lightson&#8217; but your folder names use uppercase i.e. &#8216;LightsOn&#8217;. This won&#8217;t work so change your folder names to lowercase too.<br
/> Once again, let me know how you get on.</p> ]]></content:encoded> </item> <item><title>By: BlueCougar</title><link>http://www.elanman.co.uk/2009/03/combined-style-changerrandom-header/comment-page-1/#comment-21</link> <dc:creator>BlueCougar</dc:creator> <pubDate>Tue, 10 Mar 2009 23:28:00 +0000</pubDate> <guid
isPermaLink="false">http://www.elanman.co.uk/?p=366#comment-21</guid> <description>I don&#039;t know if it matters, but I don&#039;t have the scripts right on my page, I link to them, for example: &lt;code&gt;&lt;/code&gt;
Besides that, I followed your instructions, and fixed my code but now on my test page the header and content images don&#039;t show and the second style sheet refuses to work.
[ http://www.freewebs.com/bluecougarstudio/styleswitcher.js ] here&#039;s my .js page, I troubleshooted quite a bit, I don&#039;t know if I did anything wrong...if I did I couldn&#039;t find it.</description> <content:encoded><![CDATA[<p>I don&#8217;t know if it matters, but I don&#8217;t have the scripts right on my page, I link to them, for example: <code></code><br
/> Besides that, I followed your instructions, and fixed my code but now on my test page the header and content images don&#8217;t show and the second style sheet refuses to work.<br
/> [ <a
href="http://www.freewebs.com/bluecougarstudio/styleswitcher.js" rel="nofollow">http://www.freewebs.com/bluecougarstudio/styleswitcher.js</a> ] here&#8217;s my .js page, I troubleshooted quite a bit, I don&#8217;t know if I did anything wrong&#8230;if I did I couldn&#8217;t find it.</p> ]]></content:encoded> </item> <item><title>By: ElanMan</title><link>http://www.elanman.co.uk/2009/03/combined-style-changerrandom-header/comment-page-1/#comment-20</link> <dc:creator>ElanMan</dc:creator> <pubDate>Mon, 09 Mar 2009 10:01:24 +0000</pubDate> <guid
isPermaLink="false">http://www.elanman.co.uk/?p=366#comment-20</guid> <description>OK, I&#039;ve had a quick look. This should hopefully work.
Inside your existing &lt;script&gt; tags, define a slightly modified randImg() function, like this:
&lt;p class=&quot;code&quot;&gt;&lt;code&gt;
function randImg(folder) {
var header = document.getElementById(&#039;header&#039;);
var pictures = new Array(&#039;/image1.jpg&#039;,&#039;/image2.jpg&#039;,&#039;/image3.jpg&#039;,&#039;/image4.jpg&#039;,&#039;/image5.jpg&#039;);
var numPics = pictures.length;
var chosenPic = Math.floor((Math.random() * numPics));
header.style.background = &#039;url(&#039; + folder + pictures[chosenPic] + &#039;)&#039;;
}
&lt;/code&gt;&lt;/p&gt;
and then call the randImg() function from inside your existing setActiveStyleSheet() function like this:
&lt;p class=&quot;code&quot;&gt;&lt;code&gt;
function setActiveStyleSheet(title) {
var i, a, main;
for(i=0; (a = document.getElementsByTagName(&quot;link&quot;)[i]); i++) {
if(a.getAttribute(&quot;rel&quot;).indexOf(&quot;style&quot;) != -1 &amp;&amp; a.getAttribute(&quot;title&quot;)) {
a.disabled = true;
if(a.getAttribute(&quot;title&quot;) == title) a.disabled = false;
}
}
randImg(title);
}
&lt;/code&gt;&lt;/p&gt;
For this to work, you&#039;ll need to name your image folders the same as the title attributes of your stylesheets. Hope that makes sense!
Let me know how you get on :)</description> <content:encoded><![CDATA[<p>OK, I&#8217;ve had a quick look. This should hopefully work.<br
/> Inside your existing &lt;script&gt; tags, define a slightly modified randImg() function, like this:</p><p
class="code"><code><br
/> function randImg(folder) {<br
/> var header = document.getElementById('header');<br
/> var pictures = new Array('/image1.jpg','/image2.jpg','/image3.jpg','/image4.jpg','/image5.jpg');<br
/> var numPics = pictures.length;<br
/> var chosenPic = Math.floor((Math.random() * numPics));<br
/> header.style.background = 'url(' + folder + pictures[chosenPic] + ')';<br
/> }<br
/> </code></p><p>and then call the randImg() function from inside your existing setActiveStyleSheet() function like this:</p><p
class="code"><code><br
/> function setActiveStyleSheet(title) {<br
/> var i, a, main;<br
/> for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {<br
/> if(a.getAttribute("rel").indexOf("style") != -1 &#038;&#038; a.getAttribute("title")) {<br
/> a.disabled = true;<br
/> if(a.getAttribute("title") == title) a.disabled = false;<br
/> }<br
/> }<br
/> randImg(title);<br
/> }<br
/> </code></p><p>For this to work, you&#8217;ll need to name your image folders the same as the title attributes of your stylesheets. Hope that makes sense!<br
/> Let me know how you get on <img
src='http://www.elanman.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p> ]]></content:encoded> </item> <item><title>By: ElanMan</title><link>http://www.elanman.co.uk/2009/03/combined-style-changerrandom-header/comment-page-1/#comment-18</link> <dc:creator>ElanMan</dc:creator> <pubDate>Sat, 07 Mar 2009 19:34:09 +0000</pubDate> <guid
isPermaLink="false">http://www.elanman.co.uk/?p=366#comment-18</guid> <description>@BlueCougar
I&#039;ll have a look at the code you&#039;re already using and see if I can integrate the random header for you.
I&#039;ll reply to this post with the results. :)</description> <content:encoded><![CDATA[<p>@BlueCougar<br
/> I&#8217;ll have a look at the code you&#8217;re already using and see if I can integrate the random header for you.<br
/> I&#8217;ll reply to this post with the results. <img
src='http://www.elanman.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p> ]]></content:encoded> </item> <item><title>By: BlueCougar</title><link>http://www.elanman.co.uk/2009/03/combined-style-changerrandom-header/comment-page-1/#comment-17</link> <dc:creator>BlueCougar</dc:creator> <pubDate>Sat, 07 Mar 2009 16:53:35 +0000</pubDate> <guid
isPermaLink="false">http://www.elanman.co.uk/?p=366#comment-17</guid> <description>This is really great. But I do have a small problem, I used this method, [ http://www.alistapart.com/articles/alternate/ ] in creating my style switcher it works well and has the cookie code so the pages stay in the same style...I don&#039;t suppose you have a quick code snippet for enabling random headers that goes with this code?
If it&#039;s to much of a bother I&#039;ll wait for when you add that javascript snippet on cookies, so I can use this nice code you&#039;ve made. Thanks very much for adding this</description> <content:encoded><![CDATA[<p>This is really great. But I do have a small problem, I used this method, [ <a
href="http://www.alistapart.com/articles/alternate/" rel="nofollow">http://www.alistapart.com/articles/alternate/</a> ] in creating my style switcher it works well and has the cookie code so the pages stay in the same style&#8230;I don&#8217;t suppose you have a quick code snippet for enabling random headers that goes with this code?<br
/> If it&#8217;s to much of a bother I&#8217;ll wait for when you add that javascript snippet on cookies, so I can use this nice code you&#8217;ve made. Thanks very much for adding this</p> ]]></content:encoded> </item> </channel> </rss>
