manoto1371
پنج شنبه 20 فروردین 1394, 15:12 عصر
سلام
من از کد جاوا اسکریپت زیر برای لود شدن تصادفی Css استفاده میکنم اما این کار انجام نمیشه؟
کسی میتونه کمک کنه ؟
<script>
var link = [];
link[0] = "css/bootstrap.css";
link[1] = "css/bootstrap2.css";
$(function() {
var style = link[Math.floor(Math.random() * link.length )];
alert("sddsd");
if (document.createStyleSheet){
document.createStyleSheet(style);
}else{
if(style == 0){
$('<link />',{
rel :'stylesheet',
type:'text/css',
href: style
}).appendTo('head');
$('<link />',{
rel :'stylesheet',
type:'text/css',
href: 'css/flat-ui.min.css',
}).appendTo('head');
}else{
$('<link />',{
rel :'stylesheet',
type:'text/css',
href: style
}).appendTo('head');
}
}
});
</script>
من از کد جاوا اسکریپت زیر برای لود شدن تصادفی Css استفاده میکنم اما این کار انجام نمیشه؟
کسی میتونه کمک کنه ؟
<script>
var link = [];
link[0] = "css/bootstrap.css";
link[1] = "css/bootstrap2.css";
$(function() {
var style = link[Math.floor(Math.random() * link.length )];
alert("sddsd");
if (document.createStyleSheet){
document.createStyleSheet(style);
}else{
if(style == 0){
$('<link />',{
rel :'stylesheet',
type:'text/css',
href: style
}).appendTo('head');
$('<link />',{
rel :'stylesheet',
type:'text/css',
href: 'css/flat-ui.min.css',
}).appendTo('head');
}else{
$('<link />',{
rel :'stylesheet',
type:'text/css',
href: style
}).appendTo('head');
}
}
});
</script>