
文本框 :<input id="_text" type="text" value="这里是文本框的内容" />
按钮:<input type="button" value="提交" onclick="alert(document.getElementById('_text').value)" />
<script>
function addNumber(everyone)
{
document.getElementById("text1").value += everyone
}
</script><input type="button" onclick="addNumber(1)" value= "1"></input><input type="text" id="text1"></input><input type="button" onclick="addNumber(2)" value= "2"></input>
html页面中添抄加文本框,用到的工袭具,notepad++,步骤如下:百1.
html代码部分:度
姓名:<input type="text" name="name" />网页效果图如下:
注意事项:知input要配合form表单用。道
如果你的button是button标签的话:<button id="btn">按钮</button>获取值的方法为:$("#btn").html()
如果你的button是input的button:<input type="button" value="按钮" id="btn">
获取值的方法为:$("#btn").val()
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)