|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
find name of CSS using javascript
Hi,
I need to find the name of the attached CSS file in a page by using javascript. e.g. <link rel="stylesheet" type="text/css href="style1.css" /> I need the script to find style1.css so that the name can be used later in a document.write script. I'm looking into this method because it is an automated way to write the name of CSS, saving me time over many pages.. Can it be done? |
|
#2
|
|||
|
|||
|
document.getElementsByTagName('link').item(0).getAttribute('href');
|
|
#3
|
|||
|
|||
|
cool.
Is there a way to get the full path to that file? e.g. For pages I can use document.URL or location.pathname At the moment i am using a combination of location.hostname then a string of text. e.g. var cssURL = location.hostname + '/files/css/' Cheers, Degs |
![]() |
| Viewing: Dev Shed Forums > Web Design > JavaScript Development > find name of CSS using javascript |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|