javascript点击按钮获取input元素value值

javascript点击按钮获取input元素value值:

window.onload=function(){
var oBtn=document.getElementById('btn');
var oT=document.getElementById('txt');
oBtn.onclick=function(){
alert(oT.value);
};
};

<input type="text" id="txt" />
<input type="button" id="btn" value="按钮" />

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: