1 reply [Last post]
happyhacker's picture
Last seen: 11 years 21 weeks ago
Joined: 2010-03-04
Posts: 1
Points: 2

Does anyone know if I could insert a css include line in the head part of the page after it's loaded? I imaging I would need to include some javascript in the body and run onload to access the DOM of the head. Obviously the include line would have to be below any other css statements. If this is possible what would the code be.

Chris..S's picture
Last seen: 8 years 44 weeks ago
Timezone: GMT+1
Joined: 2005-02-22
Posts: 6078
Points: 173

Yes, you can.

Yes, you can.

<script type="text/javascript">
document.write('<style type="text/css"> .js { visibility: visible; } <'+'/style>');

or put inside a js file referenced in the head. example (compare sidebar with js enabled and disabled, plus look at last line of preg.js).