473,394 Members | 1,709 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

how to use different css file in one page.

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.


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

Thanks
Apr 11 '07 #1
14 4337
acoder
16,027 Expert Mod 8TB
Set the stylesheet for the page with an id:
[HTML]<link rel="stylesheet" href="col.css" type="text/css" id="ss" />[/HTML] then when a new file is chosen, set the href to the new file:
Expand|Select|Wrap|Line Numbers
  1. document.getElementById('ss').href = 'newfile.css';
Apr 11 '07 #2
snitu
30
Set the stylesheet for the page with an id:
[HTML]<link rel="stylesheet" href="col.css" type="text/css" id="ss" />[/HTML] then when a new file is chosen, set the href to the new file:
Expand|Select|Wrap|Line Numbers
  1. document.getElementById('ss').href = 'newfile.css';
Thank
But my reqiirement is just like yahoo.com site for choose Page Option and click on color it changes the color of whole page. same thing i am doing in my website.
Plz..........................

Reply as soon as possible.


Thanks
Apr 11 '07 #3
acoder
16,027 Expert Mod 8TB
In your css files, set the colours of all the objects on the page to whatever you require.
Apr 11 '07 #4
snitu
30
In your css files, set the colours of all the objects on the page to whatever you require.

Hi

I am not getting u answer.
Apr 11 '07 #5
snitu
30
Hi

I am not getting u answer.
And one more this is i want to provide Authority to user to change the style of the mainpage of our website. using (color picker) or css file.
Apr 11 '07 #6
acoder
16,027 Expert Mod 8TB
Hi

I am not getting u answer.
Use the background-color property as well as the color property for text. That will enable you to control the color in the page.
Apr 11 '07 #7
acoder
16,027 Expert Mod 8TB
And one more this is i want to provide Authority to user to change the style of the mainpage of our website. using (color picker) or css file.
If you're using a CSS file, you can change the href attribute as I showed earlier. With regards to choosing, add an onchange to the dropdown which calls a function:
[HTML]<select ... onchange="changecss(this);">[/HTML] Make sure that the values of the options are equal to the location of the css files. Then in your function, just set the link href attribute to the value of the dropdown:
Expand|Select|Wrap|Line Numbers
  1. document.getElementById('ss').href=selObj.value;
Apr 11 '07 #8
snitu
30
If you're using a CSS file, you can change the href attribute as I showed earlier. With regards to choosing, add an onchange to the dropdown which calls a function:
[HTML]<select ... onchange="changecss(this);">[/HTML] Make sure that the values of the options are equal to the location of the css files. Then in your function, just set the link href attribute to the value of the dropdown:
Expand|Select|Wrap|Line Numbers
  1. document.getElementById('ss').href=selObj.value;
Sir
I am not getting it can u plz......... give me any complete example
Plz.............................................
Apr 11 '07 #9
devsusen
136 100+
Hi,

I think the page u like to design that can be achieved using server side scripting, CSS and programatically appling different style in the page.

susen
Apr 11 '07 #10
snitu
30
Hi,

I think the page u like to design that can be achieved using server side scripting, CSS and programatically appling different style in the page.

susen
I am designing my website by using dojo + javascript and now my requirement is to give user to change the colors of my main page of my site.
just like yahoo.com site in that the user can change the color of main page(home page) . you can go to see the site of Yahoo.com there is one option PageOption select and chose the color it will change the color the home page of Yahoo.com.


Plz.......................
See this example and reply me


Thanks
Apr 11 '07 #11
acoder
16,027 Expert Mod 8TB
See this example - a basic example showing you how to link to an external style sheet.

See the style sheet (styles.css) here. Notice the use of color and background-color.

In your case, define a few stylesheets like this using your own colours. Then use the href attribute to change the stylesheet dynamically.

Re. the select. Try, e.g. [HTML]<select ... onchange="changecss(this)">
<option value="red.css">Red<option value="blue.css">...
</select>[/HTML]
Then your function:
Expand|Select|Wrap|Line Numbers
  1. function changecss(selObj) {
  2.  document.getElementById('ss').href=selObj.value;
  3. }
Note that you have to set the external link tag's id to 'ss'.
Apr 12 '07 #12
snitu
30
Hi

Thanks.
Now my problem is Solve.
Apr 17 '07 #13
acoder
16,027 Expert Mod 8TB
No problem, you're welcome.
Apr 17 '07 #14
jagz
1
heyy guys i have the same problem :( i have website where i need to put drop downbox where user can select different style can u please help me with this.. thanxx
Dec 23 '10 #15

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

Similar topics

7
by: Bruce W...1 | last post by:
I'm a PHP newbie coming from experience with ASP.NET. I want to have a separate PHP file to support each HTML PHP page. This would be the equivalent of an ASP.NET code-behind file but using PHP....
2
by: Paul M | last post by:
Hi there, i hope someone can help me out here.. I have a input screen where i want the user to enter text in 2 different languages, english and macedonian. How is it possible to make the...
4
by: CJM | last post by:
I have an ASP page that lists files and folders in a directory. I'm using a cookie to record the last time this page was visited, and I intend to show links that are created/modified from that date...
2
by: Lois | last post by:
My website formatting knowledge is mostly HTML; I know hardly any Javascript. Recently I created a site with a nav bar in table format across the top of the page, and I made the background colour...
2
by: andylong :: andrea : azzini | last post by:
My problem is: i need to write an ASP page which first checks whether the user has permissions to download a ZIP file, and then streams the file itself if the user is allowed to see it. I have...
3
by: Helen | last post by:
How can I write a file to a mapped drive on a different server, from an ASP.Net application? Thanks Helen
13
by: Luigi | last post by:
Imagine I have a small, static, personal site (I do, actually: http://kirpi.it/). And imagine that, just below the title of the page, I would like to have a comment, or a news line, or a birthday...
4
by: | last post by:
I have earlier used an HttpModule that did URL rewrites on the BeginRequest event. Now I am trying to use the same module in a different application on a new and upgraded machine (winxp sp2). ...
6
by: dana lees | last post by:
Hello, I am developing a c# asp.net application. I have 2 forms. In the first webform ('header') i have a label. I want to reference that label from a different form ('user'), in order to...
61
by: phil-news-nospam | last post by:
Why does SVG need a different tag than other images? IMHO, SVG should be implemented as an image type just like any other image type, allowing it to work with <img> tags, and ... here is the...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.