If you want camera-drag with right-click, ideally you'd just hide the mouse (and capture it so it can't leave the bounds of the view). That's normally what games do when they have right-click dragging in the fashion you describe.
That said, I have no idea if JavaScript can capture the mouse like that.
That said, I have no idea if JavaScript can capture the mouse like that.