1.Crate more than two CSS file with different color code.
2. Upload the css files into the any of the document library. In this put in "Shared Documents".
3.Created eight CSS file and upload in the "Shared Documents".
4.Go the sharepoint Designer 2007.
5.Open site collection.
6.Go the master page under the catalogs folder.
7.Copy the default.master and paste rename into "Custom.master".
8.In the Master page <head> section add the following javascript.
<script type="text/javascript" language="javascript">
function loadjscssfile(filename, filetype){
var randomnumber=Math.floor(Math.random()*8);
// alert(randomnumber);
MyNumbers=new Array
("Customtest_green.css","Customtest_red.css","Customtest_orange.css","Customtest_pink.css","Customtest_purple.css","Customtest_turquoise.css","Customtest_yellow.css","Customtest.css");
filename="http://192.168.1.201/sites/test/Shared%20Documents/"+MyNumbers[randomnumber].toString();
if (filetype=="css"){ //if filename is an external CSS file
var fileref=document.createElement("link")
fileref.setAttribute("rel", "stylesheet")
fileref.setAttribute("type", "text/css")
fileref.setAttribute("href", filename)
}
if (typeof fileref!="undefined")
document.getElementsByTagName("head")[0].appendChild(fileref)
}
loadjscssfile("http://192.168.1.201/sites/test/Shared%20Documents/Customtest_green.css", "css") ////dynamically load and add this .css file
</script>
2. Upload the css files into the any of the document library. In this put in "Shared Documents".
3.Created eight CSS file and upload in the "Shared Documents".
4.Go the sharepoint Designer 2007.
5.Open site collection.
6.Go the master page under the catalogs folder.
7.Copy the default.master and paste rename into "Custom.master".
8.In the Master page <head> section add the following javascript.
<script type="text/javascript" language="javascript">
function loadjscssfile(filename, filetype){
var randomnumber=Math.floor(Math.random()*8);
// alert(randomnumber);
MyNumbers=new Array
("Customtest_green.css","Customtest_red.css","Customtest_orange.css","Customtest_pink.css","Customtest_purple.css","Customtest_turquoise.css","Customtest_yellow.css","Customtest.css");
filename="http://192.168.1.201/sites/test/Shared%20Documents/"+MyNumbers[randomnumber].toString();
if (filetype=="css"){ //if filename is an external CSS file
var fileref=document.createElement("link")
fileref.setAttribute("rel", "stylesheet")
fileref.setAttribute("type", "text/css")
fileref.setAttribute("href", filename)
}
if (typeof fileref!="undefined")
document.getElementsByTagName("head")[0].appendChild(fileref)
}
loadjscssfile("http://192.168.1.201/sites/test/Shared%20Documents/Customtest_green.css", "css") ////dynamically load and add this .css file
</script>
9.Save and publish the master page.
10. Now while loading the page randomly took the css.
No comments:
Post a Comment