var qcanvas = new Qcanvas({
id: 'qcanvas',
width: 300,
height: 200,
});
var tip = document.getElementById('tip');
var rect1 = qcanvas.rect({
start: [20, 20],
borderColor: 'red',
fillColor: 'green',
drag: false,
mouseout: function() {
console.log('绿色块mouseout事件');
tip.innerHTML = '绿色块mouseout事件' + parseInt(Math.random() * 10) + '
' + tip.innerHTML;
},
mouseenter: function() {
console.log('绿色块mouseenter事件');
tip.innerHTML = '绿色块mouseenter事件' + parseInt(Math.random() * 10) + '
' + tip.innerHTML;
}
})
var rect = qcanvas.rect({
start: [0, 10],
borderColor: 'red',
fillColor: 'blue',
drag: false,
mouseup: function() {
console.log('蓝色块mouseup事件');
tip.innerHTML = '蓝色块mouseup事件' + parseInt(Math.random() * 10) + '
' + tip.innerHTML;
},
mousedown: function() {
console.log('蓝色块mousedown事件');
tip.innerHTML = '蓝色块mousedown事件' + parseInt(Math.random() * 10) + '
' + tip.innerHTML;
},
mousemove: function() {
console.log('蓝色块mousemove事件');
tip.innerHTML = '蓝色块mousemove事件' + parseInt(Math.random() * 10) + '
' + tip.innerHTML;
},
mouseout: function() {
console.log('蓝色块mouseout事件');
tip.innerHTML = '蓝色块mouseout事件' + parseInt(Math.random() * 10) + '
' + tip.innerHTML;
}
})