Sto provando a ruotare fogli CSS casuali via JS - Ho il seguente script ma quando lo sto usando - non sembra funzionare?Casuale CSS via JS
function getRand(){
return Math.round(Math.random()*(css.length-1));
}
var css = new Array(
'<link rel="stylesheet" type="text/css" href="css/1.css">',
'<link rel="stylesheet" type="text/css" href="css/2.css">',
'<link rel="stylesheet" type="text/css" href="css/3.css">',
'<link rel="stylesheet" type="text/css" href="css/4.css">'
);
rand = getRand();
document.write(css[rand]);
Apprezzare qualsiasi aiuto?
Funziona quando lo provo. – Rob
hmm non sono sicuro - non funziona per me :( –
vorresti dirci che browser stai usando per testare questo? – erjiang