Internet explorer 8 设置按钮的类型,ie8

Internet explorer 8 设置按钮的类型,ie8,internet-explorer-8,Internet Explorer 8,动态创建按钮,然后尝试将其设置为按钮,而不是默认的提交 下面是我如何创建按钮和设置类型 var pickButton = document.createElement("button"); pickButton.type = "button"; IE8会出错,说: SCRIPT445: Object doesn't support this action 使用: pickButton.setAttribute('type', 'button');

动态创建按钮,然后尝试将其设置为
按钮
,而不是默认的
提交

下面是我如何创建按钮和设置类型

var pickButton = document.createElement("button");
pickButton.type = "button";
IE8会出错,说:

SCRIPT445: Object doesn't support this action 
使用:

pickButton.setAttribute('type', 'button');