Hi, everyone!
I hope you guys can help me. I´m working on a website which deals with 4 different css styles. Once in the Homepage, the user can choose one link out of four to enter the site. Depending on the link he chooses, all the following pages will follow a different style. So, my question is: how can I make this decision taken in Home to be understood by all the other pages? The css style they´ll load depends on this previous choice.. I´ve searched the web after sollutions and I think Javascript can help me, but I know just a little about it. Can you help me? I know what I have to do, theorically, but I don´t know how to translate it into a code..
Thank you all,
Rafael
6 1437 Nepomuk 3,112
Recognized Expert Specialist
...I´ve searched the web after sollutions and I think Javascript can help me, but I know just a little about it. Can you help me?
Hi Rafaell!
Obviously, you have made the same mistake as many newbies do - you confused Java with JavaScript. They aren't the same, actually not even very closely related (although the syntax has quite a few similarities). I'm moving this to the JavaScript Forum, where it belongs. Good luck with your task!
Greetings,
Nepomuk (Moderator)
I know what I have to do, theorically
what....theoret ically.... would you like to do?
Do you want to change css classes you have already defined?
Are you looking to define and handle all classes in javascript?
There are ways to do either of these, and more....do you have a page started?
the basics are: -
myHTMLElement.style.border="2px red groove"
-
myHTMLElement.style.zIndex=3
-
-
or
-
-
myHTMLElement.className="myClassName"
-
Hi Rafaell!
Obviously, you have made the same mistake as many newbies do - you confused Java with JavaScript. They aren't the same, actually not even very closely related (although the syntax has quite a few similarities). I'm moving this to the JavaScript Forum, where it belongs. Good luck with your task!
Greetings,
Nepomuk (Moderator)
Thank you! Hope I´ll be luckier now.
what....theoret ically.... would you like to do?
Do you want to change css classes you have already defined?
Are you looking to define and handle all classes in javascript?
There are ways to do either of these, and more....do you have a page started?
the basics are: -
myHTMLElement.style.border="2px red groove"
-
myHTMLElement.style.zIndex=3
-
-
or
-
-
myHTMLElement.className="myClassName"
-
Hi, zaphod42!
Thanks for your reply. I have four .css files. In the main page, I want the user to choose among four ways of loading the other pages, each way will load a .css style. The user will chose this by clicking on a link. I don´t want to change the .css files itself. And I have only a few functions in javascript.
I still don´t have the main page coded, but every other page, by now, has this line in its code: - <link rel="stylesheet" type="text/css" href="FILE.css" />
The point, I guess, is that this line shouldn´t be in each page, at least not with this "FILE.css" defined, because the instruction of loading a specific CSS file has to be given by the link in which I clicked in the main page. Is there a way to make LINK_1 on the main page load the FILE_1.css in every other page, and LINK_2 load FILE_2.css and so on?
if you want to do it client side you could add a hash to the url to tell the pages which link was clicked...but you would also have to add that hash to and local links on your page to ensure the style loads properly
acoder 16,027
Recognized Expert Moderator MVP
It would make sense to do this via the server-side, so that the CSS file is loaded during page load. You can use JavaScript if you want. Use cookies to store the preference. You may find this article useful.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: DJ WIce |
last post by:
Hi,
I have this situation:
I have a main page with content and an IFRAME on it.
The IFRAME has it's own style sheet and the body of that uses a class:
<body class="IFbody">
How can I change the backgroundcolor of the IFRAME via a function in the
|
by: Quinton |
last post by:
I'm running a website that uses CSS to format the text and a CGI
program Coranto that icludes news updates via SSI. My problem is that
some parts of the CSS don't seem to take effect on the included news.
All four link styles are used, and all four work in the included text
files. The text styles, on the other hand, seem not to work at all.
The text that's part of the actual HTML file is formated according to
the CSS codes. However, the...
|
by: dan.vendel |
last post by:
Hi,
I know nothing about javascript, but quite a lot about regulat html and
CSS.
Have bumped into a problem that people in this fine congregation
perhaps can help me with.
I'm making a webshop. When user eventually ends up at the credit card
processor's secure pages, the styles are quite different from the
actual site's. I have managed to change some basics through a control
|
by: Sam Carleton |
last post by:
How do I change the CSS colors via JavaScript DOM? Let me explain...
I am working on a Windows application (in C#) that displays some HTML.
In one place the HTML is a status window. What happens is the static
HTML page is embedded into the application. The static page displayed
and then the C# code gets a hold of the HTML DOM from the web browser
and updates what pieces need to be updated.
What I need to do now is change the colors...
|
by: Sam Carleton |
last post by:
How do I change the CSS colors via JavaScript DOM? Let me explain...
I am working on a Windows application (in C#) that displays some HTML.
In one place the HTML is a status window. What happens is the static
HTML page is embedded into the application. The static page displayed
and then the C# code gets a hold of the HTML DOM from the web browser
and updates what pieces need to be updated.
What I need to do now is change the colors...
| |
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |