如何使一个input跟随另一个input的改变而改变

oninput事件

如:

html: 

序号: <input type="text" id="xh">(也可以直接在行内调用<input type="text" id="xh" oninput="myFunction()">)

列号: <input type="text" id="lh" >

script:

document.getElementById("xh").oninput=function(){

    myFunction();

};

function myFunction() {

     document.getElementById("lh").value=document.getElementById("xh").value;
}

猜你喜欢

转载自blog.csdn.net/weixin_41700532/article/details/80653942
今日推荐