I have used this code in the past
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">'
);
rand = getRand();
document.write(css[rand]);
Now I have been told to place the function inside this event handler:
$(document).bind("projectLoadComplete", function(e, pid) {
// insert function here
});
Could someone please explain what part of my code goes where? Thanks.
I am assuming you mean to place the function call in there, and not the actual function definition..
But if you indeed have to put everything inside it