Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #35171

Re: Altering a CSS class with JavaScript?

From Maik Koenig <usenetspam@maikkoenig.de>
Newsgroups comp.lang.javascript
Subject Re: Altering a CSS class with JavaScript?
Date 2018-06-02 22:48 +0200
Message-ID <pev6rp.3g0.1@mid.maikkoenig.de> (permalink)
References <1df34733-dc9a-4edf-a4b8-92dc1de90a16@googlegroups.com> <c4bb0748-cc2e-4634-b263-42b01cb64801@googlegroups.com> <233c3ea9-b903-44ad-8435-2a6236003a38@googlegroups.com> <3197134.joGGxDtPI3@PointedEars.de>

Show all headers | View raw


Am 01.06.2018 um 13:25 schrieb Thomas 'PointedEars' Lahn:

> The most simple, compatible, and arguably most efficient, way to modify a 
> stylesheet is to append a new “link” or “style” element to the “head” 
> element.  (However, I am not certain if it works with “link” elements, too.)

  var link = document.createElement("link");
  link.href = "test.css"
  link.type = "text/css";
  link.rel = "stylesheet";
  link.media = "screen, print"
  document.body.appendChild(link);

Greetz,
MK
-- 
Kopp-Verlag-Gläubige, Religionsdeppen, rechte Vollidioten
 und ähnlicher Bio-Abfall werden ohne Hinweis ignoriert!
            - Sei eine Möwe: Scheiss drauf -

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Altering a CSS class with JavaScript? Dr J R Stockton <J.R.Stockton@physics.org> - 2018-05-31 14:44 -0700
  Re: Altering a CSS class with JavaScript? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2018-05-31 22:23 -0700
    Re: Altering a CSS class with JavaScript? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2018-05-31 22:28 -0700
      Re: Altering a CSS class with JavaScript? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2018-06-01 12:38 +0200
        Re: Altering a CSS class with JavaScript? Dr J R Stockton <J.R.Stockton@physics.org> - 2018-06-03 11:17 -0700
          Re: Altering a CSS class with JavaScript? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2018-06-05 10:50 -0700
      Re: Altering a CSS class with JavaScript? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2018-06-01 13:25 +0200
        Re: Altering a CSS class with JavaScript? Dr J R Stockton <J.R.Stockton@physics.org> - 2018-06-02 11:06 -0700
          Re: Altering a CSS class with JavaScript? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2018-06-02 20:51 +0200
            Re: Altering a CSS class with JavaScript? snipeco.2@gmail.com (Sn!pe) - 2018-06-02 21:19 +0100
        Re: Altering a CSS class with JavaScript? Maik Koenig <usenetspam@maikkoenig.de> - 2018-06-02 22:48 +0200
          Re: Altering a CSS class with JavaScript? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2018-06-03 00:25 +0200

csiph-web