By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,739 Members | 1,060 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,739 IT Pros & Developers. It's quick & easy.

how to use different css file link in one page(for changing the color of the page)

P: 30
hello

I have a problem that how to use different css files in one single page.
In that page how to pass link using dropdown menu and select link for css file and it will change the color of whole page.
(I have seen yahoo.com examlpe )i am trying to do the same work in my website.main Page.


Plz..........................
Reply me as soon as possible.

Thanks
Apr 11 '07 #1
Share this Question
Share on Google+
3 Replies


drhowarddrfine
Expert 5K+
P: 7,435
I have not done this for anything myself but, off the top of my head, I can only think of two ways. One is using javascript and the other is to let your drop down send a form to your server which reserves the page with the correct CSS file.
Apr 11 '07 #2

pravinda
P: 23
i cann't help you but i am in same problem so please member of the scripts please give the solutions not description
Apr 11 '07 #3

P: 37
hi all
here a javascript i wrote
to change the text or background color of your page,
a combobox for the colors ,and 2 checkboxes for text or background selection
,and a button to change the color.
140 colors
check it

Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head>
  3. <title>Choose a Color from the combobox to change the text color or the background color</title>
  4. <script type="text/javascript">
  5.  
  6. // Author : fjhdehoog 
  7. // How 2 use : 3 Steps
  8. // Step 1 : Copy all script including tags to your head section as in this example
  9. // Step 2 : place the span where u want the combo box to be in your body. ;P 
  10. // Step 3 : To remove colors just comment out the number of items u wanna remove from bottom to up :)
  11. //,To add colors just extend the array 
  12.  
  13.  
  14. // Author : fjhdehoog 
  15. ThaColors = new Array();
  16. ThaColors[0]='AliceBlue';
  17. ThaColors[1]='AntiqueWhite';
  18. ThaColors[2]='Aqua';
  19. ThaColors[3]='Aquamarine';
  20. ThaColors[4]='Azure';
  21. ThaColors[5]='Beige';
  22. ThaColors[6]='Bisque';
  23. ThaColors[7]='Black';
  24. ThaColors[8]='BlanchedAlmond';
  25. ThaColors[9]='Blue';
  26. ThaColors[10]='BlueViolet';
  27. ThaColors[11]='Brown';
  28. ThaColors[12]='BurlyWood';
  29. ThaColors[13]='CadetBlue';
  30. ThaColors[14]='Chartreuse';
  31. ThaColors[15]='Chocolate';
  32. ThaColors[16]='Coral';
  33. ThaColors[17]='CornflowerBlue';
  34. ThaColors[18]='Cornsilk';
  35. ThaColors[19]='Crimson';
  36. ThaColors[20]='Cyan';
  37. ThaColors[21]='DarkBlue';
  38. ThaColors[22]='DarkCyan';
  39. ThaColors[23]='DarkGoldenRod';
  40. ThaColors[24]='DarkGray';
  41. ThaColors[25]='DarkGreen';
  42. ThaColors[26]='DarkKhaki';
  43. ThaColors[27]='DarkMagenta';
  44. ThaColors[28]='DarkOliveGreen';
  45. ThaColors[29]='Darkorange';
  46. ThaColors[30]='DarkOrchid';
  47. ThaColors[31]='DarkRed';
  48. ThaColors[32]='DarkSalmon';
  49. ThaColors[33]='DarkSeaGreen';
  50. ThaColors[34]='DarkSlateBlue';
  51. ThaColors[35]='DarkSlateGray';
  52. ThaColors[36]='DarkTurquoise';
  53. ThaColors[37]='DarkViolet';
  54. ThaColors[38]='DeepPink';
  55. ThaColors[39]='DeepSkyBlue';
  56. ThaColors[40]='DimGray';
  57. ThaColors[41]='DodgerBlue';
  58. ThaColors[42]='FireBrick';
  59. ThaColors[43]='FloralWhite';
  60. ThaColors[44]='ForestGreen';
  61. ThaColors[45]='Fuchsia';
  62. ThaColors[46]='Gainsboro';
  63. ThaColors[47]='GhostWhite';
  64. ThaColors[48]='Gold';
  65. ThaColors[49]='GoldenRod';
  66. ThaColors[50]='Gray';
  67. ThaColors[51]='Green';
  68. ThaColors[52]='GreenYellow';
  69. ThaColors[53]='HoneyDew';
  70. ThaColors[54]='HotPink';
  71. ThaColors[55]='IndianRed';
  72. ThaColors[56]='Indigo';
  73. ThaColors[57]='Ivory';
  74. ThaColors[58]='Khaki';
  75. ThaColors[59]='Lavender';
  76. ThaColors[60]='LavenderBlush';
  77. ThaColors[61]='LawnGreen';
  78. ThaColors[62]='LemonChiffon';
  79. ThaColors[63]='LightBlue';
  80. ThaColors[64]='LightCoral';
  81. ThaColors[65]='LightCyan';
  82. ThaColors[66]='LightGoldenRodYellow';
  83. ThaColors[67]='LightGrey';
  84. ThaColors[68]='LightGreen';
  85. ThaColors[69]='LightPink';
  86. ThaColors[70]='LightSalmon';
  87. ThaColors[71]='LightSeaGreen';
  88. ThaColors[72]='LightSkyBlue';
  89. ThaColors[73]='LightSlateGray';
  90. ThaColors[74]='LightSteelBlue';
  91. ThaColors[75]='LightYellow';
  92. ThaColors[76]='Lime';
  93. ThaColors[77]='LimeGreen';
  94. ThaColors[78]='Linen';
  95. ThaColors[79]='Magenta';
  96. ThaColors[80]='Maroon';
  97. ThaColors[81]='MediumAquaMarine';
  98. ThaColors[82]='MediumBlue';
  99. ThaColors[83]='MediumOrchid';
  100. ThaColors[84]='MediumPurple';
  101. ThaColors[85]='MediumSeaGreen';
  102. ThaColors[86]='MediumSlateBlue';
  103. ThaColors[87]='MediumSpringGreen';
  104. ThaColors[88]='MediumTurquoise';
  105. ThaColors[89]='MediumVioletRed';
  106. ThaColors[90]='MidnightBlue';
  107. ThaColors[91]='MintCream';
  108. ThaColors[92]='MistyRose';
  109. ThaColors[93]='Moccasin';
  110. ThaColors[94]='NavajoWhite';
  111. ThaColors[95]='Navy';
  112. ThaColors[96]='OldLace';
  113. ThaColors[97]='Olive';
  114. ThaColors[98]='OliveDrab';
  115. ThaColors[99]='Orange';
  116. ThaColors[100]='OrangeRed';
  117. ThaColors[101]='Orchid';
  118. ThaColors[102]='PaleGoldenRod';
  119. ThaColors[103]='PaleGreen';
  120. ThaColors[104]='PaleTurquoise';
  121. ThaColors[105]='PaleVioletRed';
  122. ThaColors[106]='PapayaWhip';
  123. ThaColors[107]='PeachPuff';
  124. ThaColors[108]='Peru';
  125. ThaColors[109]='Pink';
  126. ThaColors[110]='Plum';
  127. ThaColors[111]='PowderBlue';
  128. ThaColors[112]='Purple';
  129. ThaColors[113]='Red';
  130. ThaColors[114]='RosyBrown';
  131. ThaColors[115]='RoyalBlue';
  132. ThaColors[116]='SaddleBrown';
  133. ThaColors[117]='Salmon';
  134. ThaColors[118]='SandyBrown';
  135. ThaColors[119]='SeaGreen';
  136. ThaColors[120]='SeaShell';
  137. ThaColors[121]='Sienna';
  138. ThaColors[122]='Silver';
  139. ThaColors[123]='SkyBlue';
  140. ThaColors[124]='SlateBlue';
  141. ThaColors[125]='SlateGray';
  142. ThaColors[126]='Snow';
  143. ThaColors[127]='SpringGreen';
  144. ThaColors[128]='SteelBlue';
  145. ThaColors[129]='Tan';
  146. ThaColors[130]='Teal';
  147. ThaColors[131]='Thistle';
  148. ThaColors[132]='Tomato';
  149. ThaColors[133]='Turquoise';
  150. ThaColors[134]='Violet';
  151. ThaColors[135]='Wheat';
  152. ThaColors[136]='White';
  153. ThaColors[137]='WhiteSmoke';
  154. ThaColors[138]='Yellow';
  155. ThaColors[139]='YellowGreen';
  156. //------ NO NEED TO ALTER BELOW   -------------------
  157. NrOfColorsInArray=ThaColors.length;
  158. document.write('<span id="dummy" style="visibility:hidden;"></span>'); 
  159. setTimeout('showchangecolorspan()',500);
  160. function showchangecolorspan(){    
  161. TheSpan=document.getElementById('ColorSelectionSpan');
  162. if (TheSpan==null){setTimeout('showchangecolorspan()',1000);}
  163. else{    
  164. document.getElementById('dummy').innerText='<form name="settcolor" action=""><select id="Fgcolors">'; 
  165. for (Y=0; Y < NrOfColorsInArray; ++Y){
  166. document.getElementById('dummy').innerText+='<option style="background-color:'+ ThaColors[Y]+';color:'+ ThaColors[Y]+';" value="' + ThaColors[Y] + '">' + ThaColors[Y]; 
  167. document.getElementById('dummy').innerText+='</select><br><br><input type="checkbox" id="changetext" onclick="Getstatetxt()" value="fg" checked>Change Text color<br><input type="checkbox" id="changebg" onclick="Getstatebg()" value="bg" unchecked>Change background color<br><input type="button" onclick="changecolor()" value="change the color"></form>';
  168. TheSpan.innerHTML=document.getElementById('dummy').innerText;
  169. document.getElementById('dummy').innerText='';;
  170. }
  171. }//
  172. function changecolor(){ 
  173. XColor=document.forms['settcolor'].Fgcolors.value;
  174. for (X=0; X < NrOfColorsInArray; ++X){
  175. if(XColor==ThaColors[X]){NColor=ThaColors[X];X=NrOfColorsInArray;}else {} 
  176. if (document.forms['settcolor'].changetext.checked){document.fgColor=NColor;}
  177. else if (document.forms['settcolor'].changebg.checked){document.bgColor=NColor;}
  178. }//     
  179.  
  180.  function Getstatetxt(){
  181.  if (document.forms['settcolor'].changetext.checked==true){
  182. document.forms['settcolor'].changebg.checked=false;
  183. }else{}    
  184.  }
  185.    function Getstatebg(){
  186.  if (document.forms['settcolor'].changebg.checked==true){
  187. document.forms['settcolor'].changetext.checked=false;
  188. }else{}
  189.  
  190. }     
  191. </script>
  192. </head>
  193. <body > 
  194. Choose a Color to change the text color or the background color
  195. <span id="ColorSelectionSpan"></span>    
  196. </body>
  197. </html>
  198.  
let me know what u think about it
peace
Apr 17 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.