document.forms['form'].elements['button'].setAttribute("onClick","someotherfunction()")
An excellent example of how not to set an event (or name elements) 
rotate_bg.ct=rotate_bg.ct++<3? rotate_bg.ct : 0;
Note here the difference between ++rotate_bg.ct and rotate_bg.ct++: the fact that you've used the latter here means that rotate_bg.ct will reach 3 before being reset.
Personally, I would do it like this:
Code:
<script type="text/javascript">
function rotateBackground() {
return document.body.style.backgroundColor =
rotateBackground.backgrounds[
++rotateBackground.current %
rotateBackground.backgrounds.length
];
}
rotateBackground.current = 0;
rotateBackground.backgrounds = [
'yellow',
'red',
'green',
'blue'
];
</script>
<input type="button" onclick="rotateBackground(); return false;" value="Change background">
Bookmarks