日期:2014-05-16 浏览次数:20379 次
<p>
<input name="q" type="text" />
<input name="commit" type="submit" value="生成" />
</p>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>
<body>
<p>
<input name="q" type="text" />
<input name="commit" id="comment" type="submit" value="生成" />
</p>
<script type="text/javascript">
document.getElementById('comment').onclick=function(){
var inE=document.createElement('input');
var inT_Att_name=document.createAttribute('name');
inT_Att_name.value="q";
inE.setAttributeNode(inT_Att_name);
var inT_Att_type=document.createAttribute('type');
inT_Att_type.value="text";
inE.setAttributeNode(inT_Att_type);
this.parentNode.insertBefore(inE,this);
}
</script>
</body>
</html>