Controlling a dc motor over web

Hello, I stumbled upon this video where he controls the speed of a motor using python and php he just sends a value to the arduino over serial. But I'm curious is there a way to replace the submit button with two arrows and when you press and hold the button the motor rotates and when you release the button the motor stops rotating? If anyone knows how to do that post here please :)

You can look at the source of the below web page that has onmousedown and onmouseup html code.