Creates an instance of the element for the specified tag
Example:
<SCRIPT>
function fnCreate(){
oData.innerHTML="";
var oOption=oSel.options[oSel.selectedIndex];
if(oOption.text.length>0){
var aElement=document.createElement(oOption.text);
eval("aElement." + oOption.value + "='" + oText.value + "'");
if(oOption.text=="A"){
aElement.href="javascript:alert('A link.')";
}
}
oData.appendChild(aElement);
}
</SCRIPT>
<SELECT ID="oSel" onchange="fnCreate()">
<OPTION VALUE="innerText">A
<OPTION VALUE="value"><INPUT TYPE="button">
</SELECT>
<SELECT ID=oText onchange="fnCreate()">
<OPTION>
<OPTION VALUE="Text">Text
<OPTION VALUE="More and More Text">More and More Text
</SELECT>
<SPAN ID="oData" ></SPAN>
Example:
<SCRIPT>
function fnCreate(){
oData.innerHTML="";
var oOption=oSel.options[oSel.selectedIndex];
if(oOption.text.length>0){
var aElement=document.createElement(oOption.text);
eval("aElement." + oOption.value + "='" + oText.value + "'");
if(oOption.text=="A"){
aElement.href="javascript:alert('A link.')";
}
}
oData.appendChild(aElement);
}
</SCRIPT>
<SELECT ID="oSel" onchange="fnCreate()">
<OPTION VALUE="innerText">A
<OPTION VALUE="value"><INPUT TYPE="button">
</SELECT>
<SELECT ID=oText onchange="fnCreate()">
<OPTION>
<OPTION VALUE="Text">Text
<OPTION VALUE="More and More Text">More and More Text
</SELECT>
<SPAN ID="oData" ></SPAN>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货