Come posso chiamare un css da una funzione?
Grazie.codice:<head> <script type="text/javascript"> function apricss() { <link href="file.css" rel="stylesheet" type="text/css"> } </script> </head> <body onLoad="apricss();"> </body>
Come posso chiamare un css da una funzione?
Grazie.codice:<head> <script type="text/javascript"> function apricss() { <link href="file.css" rel="stylesheet" type="text/css"> } </script> </head> <body onLoad="apricss();"> </body>
Non si puo`.
Quello che puoi fare tramite JS e` assegnare una classe ad un oggetto gia` esistente, oppure modificare un attributo ad un oggetto.
Esempi:(le parole TUTTOMAIUSCOLO sono da sostituire)codice:document.getElementById('IDOGGETTO').className = 'NOMECLASSE'; document.getElementById('IDOGGETTO').color = 'red'; document.getElementById('IDOGGETTO').backgroundColor = '#c00';
Nota che le maiuscole/minuscole sono significative (tranne qualche browser vecchio tipo)
Nuova politica di maggiore severita` sui titoli delle discussioni: (ri)leggete il regolamento
No domande tecniche in messaggi privati