function lastTime(){
var lastTime=new Date();
var h=lastTime.getFullYear();
var m=lastTime.getMonth();
if(m==0){
h=h-1;
m=12;
}
m= m<10?"0"+m:m;
return h+""+m;
};
$(document).ready(function() {
//此处把时间赋值到你设置的value中
document.getElementById("realMonth").value = lastTime();
});
</script>