This doesn’t really have anything to do with the Particle.function()
but only with the HTML code.
If you want to have a nicer client side there, you might want to look into ParticleJS
You can also have a look how these sites are built
http://jordymoors.nl/interface/
http://suda.github.io/particle-web-interface/
And this tutorial (and others by the awesome @bko)
Tutorial: Spark Variable and Function on One Web Page