zoukankan      html  css  js  c++  java
  • createElement Method(document)

    <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">&lt;INPUT TYPE="button"&gt;
    </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>
    http://msdn2.microsoft.com/en-us/library/ms536389.aspx
    <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>
  • 相关阅读:
    杜教筛
    GCD Counting Codeforces
    洛谷 P4317 花神的数论题 || bzoj3209
    About set HDU
    Queue Sequence HDU
    bzoj2154||洛谷P1829 Crash的数字表格&&JZPTAB && bzoj3309 DZY Loves Math
    洛谷 P1445 [Violet]樱花
    洛谷 P2158 [SDOI2008]仪仗队 && 洛谷 P1447 [NOI2010]能量采集
    nginx中使用waf防火墙
    wordpress安装
  • 原文地址:https://www.cnblogs.com/simhare/p/923620.html
Copyright © 2011-2022 走看看