473,803 Members | 4,400 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Changing CSS styles with javascript

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
panel, but not everything that needs to be changed to make it look OK.

The pages are generated dynamically. In the head section, there's the
CSS which I cannot access/change. Many tags also have inline styles
(e.g. <span style="font-family: Times...blah blah">

What I'm trying to do is to...

1) Add styles AFTER the body tag (I can do that, but not in the head)
2) Use a javascript, placed in the body, that substitutes the classes
and styles in the head to the corresponding styles defined in the body.

I have Googled a lot, and eventually found this page:
http://www.onlinetools.org/articles/...eparation.html
which I think is addressing a similar (or the same?) issue.

But if someone can point to a tutorial or some help for me who is a
complete ignoramus about javascript, and that will help me achieve what
I want, that would be highly appreciated.

Cheers,

Sep 13 '05
12 2578
da********@gmai l.com wrote:
With my limited knowledge about javascript, it seems to me as if both
examples require code in the head section, no? If so, I'm sorry to say
that I can't use neither.


You can do this approach without placing any code
in the <head></head> at all, as long as you can get some of your content
delivered inside that page delivery.
--
--.
--=<> Dr. Clue (A.K.A. Ian A. Storms) <>=-- C++,HTML, CSS,Javascript
--=<> http://resume.drclue.net <>=-- AJAX, SOAP, XML, HTTP
--=<> http://www.drclue.net <>=-- SERVLETS,TCP/IP, SQL
--.
Sep 14 '05 #11
Dr Clue wrote in message news:Fd******** *********@newsr ead2.news.pas.e arthlink.net...
[...]
Heres a demo that loads new CSS stylesheet files on the fly.
It can be raided for all the basic components to beat on yourpage.
http://www.drclue.net/projects/jsDHT.../OperaCSS.html

Heres another that tears a page apart and translates it to another form
http://www.drclue.net/projects/jsDHT.../HTML2CSS.html


Your examples (and work) are impressive, I have a small remark/comment
on the HTML2CSS.html page(s)

I loaded "lesson 4" and realized how horribly mis<tag>ged the page was.
I don't know if it's on purpose or if you took the pages as they were
and didn't validate them.
example 1:

<body bgcolor="#fffff f">
<p>
<table border="0" width="100%">
<tbody>
[...]

</tbody></table>
</p><p></p>
^^^
endtag without opening tag. According to the DTDs the P element cannot contain
table elements.
<!ELEMENT P - O (%inline;)* -- paragraph -->
<!ENTITY % inline "#PCDATA | %fontstyle; | %phrase; | %special; | %formctrl;">
<!ENTITY % fontstyle "TT | I | B | BIG | SMALL">
<!ENTITY % phrase "EM | STRONG | DFN | CODE | SAMP | KBD | VAR | CITE | ABBR | ACRONYM" >
<!ENTITY % special "A | IMG | OBJECT | BR | SCRIPT | MAP | Q | SUB | SUP | SPAN | BDO">
<!ENTITY % formctrl "INPUT | SELECT | TEXTAREA | LABEL | BUTTON">
in other words, the <p> tag was closed when before <table>
and now </p> is there all by itself.

The same applies to the following (<h2> within <h5>):

<h5>
<center>
<h2><font face="Verdana, Arial, Helvetica, sans-serif">Lesson 4 -- Tools to
Use in Selecting Materials</font> </h2>
</center>
</h5>

<!ENTITY % heading "H1|H2|H3|H4|H5 |H6">
<!ELEMENT (%heading;) - - (%inline;)* -- heading -->
<!ENTITY % inline "#PCDATA | %fontstyle; | %phrase; | %special; | %formctrl;">
<!ENTITY % fontstyle "TT | I | B | BIG | SMALL">
<!ENTITY % phrase "EM | STRONG | DFN | CODE | SAMP | KBD | VAR | CITE | ABBR | ACRONYM" >
<!ENTITY % special "A | IMG | OBJECT | BR | SCRIPT | MAP | Q | SUB | SUP | SPAN | BDO">
<!ENTITY % formctrl "INPUT | SELECT | TEXTAREA | LABEL | BUTTON">

only here the closing tag is mandatory. You cannot nest certain block elements.
Sep 15 '05 #12
Robi wrote:
Dr Clue wrote in message news:Fd******** *********@newsr ead2.news.pas.e arthlink.net...
Heres a demo that loads new CSS stylesheet files on the fly.
It can be raided for all the basic components to beat on yourpage.
http://www.drclue.net/projects/jsDHT.../OperaCSS.html

Heres another that tears a page apart and translates it to another form
http://www.drclue.net/projects/jsDHT.../HTML2CSS.html

Your examples (and work) are impressive, I have a small remark/comment
on the HTML2CSS.html page(s)

I loaded "lesson 4" and realized how horribly mis<tag>ged the page was.
I don't know if it's on purpose or if you took the pages as they were
and didn't validate them.


The purpose of the tool was to aid someone converting nearly a thousand
yucky pages of tag soup, so the ditty was developed in one evening
to work with the pages as they existed, and therefore w/o the benefit
of any validation.


--
--.
--=<> Dr. Clue (A.K.A. Ian A. Storms) <>=-- C++,HTML, CSS,Javascript
--=<> http://resume.drclue.net <>=-- AJAX, SOAP, XML, HTTP
--=<> http://www.drclue.net <>=-- SERVLETS,TCP/IP, SQL
--.
Sep 15 '05 #13

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
10345
by: Jeff Thies | last post by:
I have a number of elements of "some-class". I'd like to change the styles of some-class: from ..some-class{color: red; display: block} to
5
1554
by: Andrew Poulos | last post by:
I'm trying to change a style in a stylesheet. The following code works in FF, MZ, and IE6 but IE 5 gives the error of "invalid procedure call or argument": var oStyleSheet = window.document.styleSheets.imports; oStyleSheet.addRule("td","font-size:1.2em;"); Is there a way to do this with IE 5? Andrew Poulos
5
1454
by: T. Wong | last post by:
I want to have a single CSS style sheet control the look of my whole asp.net application but I need to set the values in this CSS from code in the start page as the CSS values will be stored in a data base. First, is this possible? Since CSS is plain text I could manipulate it all with string string functions in code, BUT, are there any classes or functions that make it easier to affect CSS parameters at run time?
8
3934
by: Bosconian | last post by:
I have two multiple select inputs. Initially the first contains a bunch of items and the second is empty. Using a common method, I move items back and forth by double clicking on them. This portion works perfectly, but I would also like to change the background color of the select element with the current focus. I have defined the following classes: ..selected {
4
1817
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...
10
4330
by: sbaker8688 | last post by:
My God, how on earth do you use javacript to change the text color of an input element, and have it work with IE??? I've tried numerous solutions. All of them work on browsers such as Mozilla. But none of them work on IE. This works in every browser I've tried besides IE: var whatever = document.createElement( 'input' ); whatever.type = 'text'; // (more code)...
5
1883
by: Dinsdale | last post by:
Without using CSS styles or linked stylesheets, I need to apply formatting to text links that use rollover effects. I can NOT get the underline to show using this technique: <A onmouseover="this.style.color='#000000'" style="FONT-SIZE: 12pt; COLOR: #000000; FONT-FAMILY: Arial, Helvetica; TEXT-DECORATION: underline;" onmouseout="this.style.color='#000000' TEXT-DECORATION: none;" href="#">Search</A>
4
2714
by: splounx | last post by:
Hi there, I am a relative CSS & JavaScript novice and I have a particular problem that is beyond my level of knowledge so I thought I'd tap the collective wisdom of this group. I would like to know if there is a means of writing JavaScript that will dynamically display the styles which are currently applied to any DOM element on a web page ( i.e., those applied by ID, those applied by class, etc.) as the user moves their mouse over...
6
1437
by: Rafaell | last post by:
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.....
0
9564
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,...
0
10548
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10316
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10295
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,...
0
9125
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7604
isladogs
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...
0
6842
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();...
2
3798
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2970
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.