Próbuję obrócić losowe arkusze CSS przez JS - mam następujący skrypt, ale kiedy go używam - to nie wydaje się działać?Losowe CSS poprzez 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]);
Doceniam każdą pomoc?
Działa, gdy próbuję. – Rob
hmm nie jestem pewien - to nie działa dla mnie :( –
czy chciałbyś nam powiedzieć, jakich przeglądarek używasz do testowania tego? – erjiang