EduCoder_web training homework--JavaScript learning manual 15: event handling

Today is the last one on the web.
celebrate! ! !
还没有关注公众号的同学们,快关注啊! 在今年春节时期,我会给大家一点小小的福利。真的很小啊,不要抱有过多期望,但是重在参与。期待你的参与!

first round

//请在此处编写代码
		/********** Begin **********/
        document.getElementById("button2").onclick=function(){
    
    
            listenButton2();
        }
        document.getElementById("button3").addEventListener("click",function(){
    
    
            listenButton3();
        })
        
        
		/********** End **********/

Second level

//请在此处编写代码
		/********** Begin **********/
       console.log("Welcome!");
      
		/********** End **********/

Third pass

//请在此处编写代码
			/********** Begin **********/
            var myButton = document.getElementById("but");
            myButton.addEventListener("click",function() {
    
    
                var myElement = document.getElementById("p");
                myElement.innerText="clicked";
            })
			/********** End **********/

Fourth level

	//请在此处编写代码
				/********** Begin **********/
                var code = event.which;
                if (code == 13) {
    
    
                    console.log("cannot use enter");
                }
				/********** End **********/

Fifth level

	//请在此处编写代码
			/********** Begin **********/
            if(document.getElementById("input").value.length<=12){
    
    
                console.log("too short input")
            }
            
            
			/********** End **********/

Sixth pass

  <!-- 请在此处编写代码 -->
            <!---------Begin--------->
            <p ondrag="dragging(event)" id="p1" draggable="true">drag me</p>
            <!---------End--------->
        </div>
        <script>
            function dragging(event) {
    
    
			  /********** Begin **********/
                console.log(event.target.innerText);
                /********** End **********/

Seventh pass

	//请在此处编写代码
			/********** Begin **********/
             window.event?window.event.cancelBubble=true:event.stopPropagation();
           /********** End **********/

who I am?
Two Xianqiao traffic commissioner
to China Shanxi Road resident representative of
the pineal bombs shake three-dimensional BI vaginal Master Jin
Chen e e University City sub-
skipping ten experts

earthy experts
welcome attention to my public No.
Let's discuss learning about life
in There are more resources waiting for you here.
Welcome to the online conversation!
Insert picture description here

Guess you like

Origin blog.csdn.net/weixin_45803282/article/details/112633972