javascript获取设置输入框内容

代码,

html 复制代码
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>获取设置输入框内容</title>
</head>
<body>
 
<button onclick="getinput()">click me</button>
	<div id="div1">
    <input type="text" size="50" id="t0" value="1,2,2,13,7" />
	<input type="text" size="50" id="t1" value="" />
	</div>
	
<script>
    var str="";
	function getinput() {
        str = document.getElementById("t0").value;
		document.getElementById("t1").value = str;
	}
</script>
 
</body>
</html>

运行如下;

单击按钮;

相关推荐
林恒smileZAZ31 分钟前
Vue<前端页面版本检测>
前端·javascript·vue.js
014-code4 小时前
订单超时取消与库存回滚的完整实现(延迟任务 + 状态机)
java·开发语言
lly2024065 小时前
组合模式(Composite Pattern)
开发语言
我是Superman丶5 小时前
Element UI 表格某行突出悬浮效果
前端·javascript·vue.js
游乐码5 小时前
c#泛型约束
开发语言·c#
Dontla5 小时前
go语言Windows安装教程(安装go安装Golang安装)(GOPATH、Go Modules)
开发语言·windows·golang
chushiyunen5 小时前
python rest请求、requests
开发语言·python
Huanzhi_Lin5 小时前
关于V8/MajorGC/MinorGC——性能优化
javascript·性能优化·ts·js·v8·新生代·老生代
铁东博客5 小时前
Go实现周易大衍筮法三变取爻
开发语言·后端·golang
baidu_huihui5 小时前
在 CentOS 9 上安装 pip(Python 的包管理工具)
开发语言·python·pip