No, this looks wrong.
Please don't abuse the `onclick`-attribute. Use a JS file/function/whatever if possible