var Rand1 = Math.floor(Math.random()*3);
var Rand2 = Rand1;
while ( Rand2 == Rand1 ){
var Rand2 = Math.floor(Math.random()*3);
}
var step1 = Rand1;
var step2 = Rand2;
function moveto(step1, step2) {
var w = $(document).width();
$('#full').animate({
left: -(step1*w)
}, {
duration: 3000,
});
}
//what element is this supposed to be?
class="img bg-img1" OnClick="moveto('1');">
My problem is: I need to assign the random number given by Rand1 into the OnClick=”moveto(‘Rand1’); how do i do that ?
Try this and remove the onclick from your inline button/element: http://jsfiddle.net/GApnw/
Or do the call to get the RandomNumbers within your moveto, if you don’t give numbers elsewhere.