Have your tried:

object.setAttribute("type", "button");