xxxxxxxxxx
25
// Please copy and paste the code to the p5 web editor to do the following questions.
var nameP;
function setup() {
noCanvas();
// Create a p element
nameP = createP('Move your mouse here');
// Attach a callback function called overpara to the p element's mouseOver event
nameP.mouseOver(overpara);
// Attach a callback function called outpara to the p element's mouseOut event
nameP.mouseOut(outpara);
}
function overpara() {
// change p element's html content
nameP.html('your mouse is over me');
}
function outpara() {
// change p element's html content
nameP.html('your mouse is out');
}