Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing styles using javascript styleswitch

Status
Not open for further replies.

chrismassey

Programmer
Joined
Aug 24, 2007
Messages
264
Location
GB
Hello,

I have created a script which automatically creates CSS pages when needed. Because these pages can be created in all sorts of locations I must link to the style sheets using the full URL, and also the full URL to link to the javascript file which changes the stylesheet. However, my page automatically picks up the first style sheet, but I am unable to change styles using the stylesheet switcher

Instead of posting the code, here is the link to an example page, and you can obviously view the source from there...


If you want me to post the HTM code instead let me know

Thank you very much

Chris
 
Hey,

I apologise, problem solved...

I hadn't given the alternative style sheets their URL.

I have another question though...

I have tried creating a blank style sheet, however when its selected the style remains on the previous style. I was hoping that all styles will be removed and I can view a plain default page perfect for printing. If I remove all my style sheets, then the page can't connect to one, and then I get a plain default page just like I want. But I want to be able to switch to it.
Any ideas?
 
Hi

Chris said:
I have tried creating a blank style sheet, however when its selected the style remains on the previous style.
No idea what you done, that link gives 404. But yes, I had similar problems with some methods. When I changed from one alternative stylesheet to another and the new one did not set some properties, the previous settings remained visible.

Anyway, setting all styles to disabled works flawless.


Feherke.
 
Hey, sorry I removed the webpage at the end of the day because of continuous work on my project. Ill try and set the style to disabled... But i'm not used to using javascript so i'm not 100% sure on how I would do this in an empty style sheet (or one with style rules in it)

I suppose this isn't a javascript question anymore, because I only want to disable the styles for one of the style sheets therefore is there a rule like

rule: disablestyles;

Thanks for your help

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top