|
发表于 2020-6-22 08:30:01
|
显示全部楼层
是不是调用这两个函数
var newInput = document.createElement("INPUT");
document.body.appendChild(newInput);
<HTML>
<HEAD>
<SCRIPT>
function createRadioButton(){
// Create radio button object with value="First Choice" and then insert
// this element into the document hierarchy.
var newRadioButton = document.createElement("<INPUT TYPE='RADIO' NAME='RADIOTEST' VALUE='First Choice'>")
document.body.insertBefore(newRadioButton);
// Create radio button object with value="Second Choice" and then insert
// this element into the document hierarchy.
newRadioButton = document.createElement("<INPUT TYPE='RADIO' NAME='RADIOTEST' VALUE='Second Choice'>")
document.body.insertBefore(newRadioButton);
}
</SCRIPT>
</HEAD>
<BODY>
<INPUT TYPE="BUTTON" ONCLICK="createRadioButton()" VALUE="Create two Radio Buttons"><BR>
<INPUT TYPE="BUTTON" ONCLICK="alert ( document.body.outerHTML )" VALUE="Click here to see HTML">
<BODY>
</HTML>
|
|