day06_作業(yè)

image.png
<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
        <style type="text/css">
            #div1 p{
                position: relative;
                width: 200px;
                height: 50px;
                color: white;
                line-height: 50px;
            }
            #div1 p button{
                position: absolute;
                right: 5px;
                margin-top: 15px;
                color: white;
                background-color:rgba(0,0,0,0);
                border-color: rgba(0,0,0,0);
            }
            #div2 input{
                border: 0;
                border-bottom: 1px solid black;
                width: 200px;
                height: 40px;
                font-size: 20px;
            }
            
            #div2 button{
                background-color: red;
                color: white;
                font-size: 15px;
                border: 0;
                width: 80px;
                height: 30px;
            }
        </style>
    </head>
    <body id="b1">
        <div id="div1">
            
        
            
        </div>
        <div id="div2">
            <input type="text" name="" id="d2i" value="11" />
            <button id="d2b">確定</button>
        </div>
    </body>
    

</html>

<script type="text/javascript">
        
        dNode = document.getElementById('div1')
        dNode.style.color = 'white'
        dNode.style.textAlign = 'center'
        
        

        
        d2b1 = document.getElementById('d2b')
        d2i1 = document.getElementById('d2i')
        
        d2b1.onclick = function(){
            r1 =  parseInt(Math.random()*255)
            r2 =  parseInt(Math.random()*255)
            r3 =  parseInt(Math.random()*255)
            p0 = document.createElement('p')
            dNode.insertBefore(p0, dNode.firstElementChild)
            p0.style.backgroundColor = 'rgba('+r1+','+r2+','+r3+','+'0.6)'
            p0.innerText = d2i.value
            p0b = document.createElement('button')
            p0.appendChild(p0b)
            p0b.innerText = 'X' 
            
            
        
        }
        
        new_dNode = document.getElementById('div1')
            p1 = new_dNode.children
            console.log(p1)
            for (x in p1){
                if (x == 'length'){
                    break
                }
                p1p = p1[x]
                console.log(p1p)
                p1pd = p1p.children
                p1pd.onClick = function(){
                    p1pd.remove()
                }
            }
        
            
    
    
        

        
        
    </script>
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • 1. 求s=a+aa+aaa+aaaa+aa...a的值,其中a是?個(gè)數(shù)字。例如2+22+222+2222+222...
    ____空白閱讀 458評(píng)論 0 4
  • 1、輸入一個(gè)字符串,打印所有奇數(shù)位上的字符(下標(biāo)是1,3,5,7…位上的字符)。例如: 輸入'abcd1234 '...
    劉茂森閱讀 211評(píng)論 0 0
  • 輸入一個(gè)字符串,打印所有奇數(shù)位上的字符(下標(biāo)是1,3,5,7…位上的字符)例如: 輸入'abcd1234 ' **...
    筱哥家的小跟班閱讀 148評(píng)論 0 0
  • 1.已知一個(gè)列表,求列表中心元素。 2.已知一個(gè)列表,求所有元素和。 3.已知一個(gè)列表,輸出所有奇數(shù)下標(biāo)元素。 4...
    barriers閱讀 197評(píng)論 0 0

友情鏈接更多精彩內(nèi)容