日期:2014-05-16 浏览次数:20487 次
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>copy.html</title>
	<meta http-equiv="content-type" content="text/html; charset=UTF-8">
	<script type="text/javascript" src="/scripts/jQuery/jquery-1.3.2.js"></script>
	<script type="text/javascript">
		function copyContent(){
			var fromText=$("#fromText").val();
			arr=eval('('+fromText+')')
			$("#userName").val(arr.userName);
			$("#age").val(arr.age);
			$("#birthday").val(arr.birthday);
			$("#degree").val(arr.degree);
			return true;
		}
	</script>
  </head>
<body>
	<textarea rows="10" cols="50" id="fromText">
		{ 
			userName:'frady',
			age:'27',
			birthday:'6-13',
			degree:'2'
		}
	</textarea>
	<input id="userName" name="userName" />
	<input id="age" name="age" />
	<input id="birthday" name="birthday" />
	<select name="degree" id="degree">
		<option value="1">初中</option>
		<option value="2">高中</option>
		<option value="3">本科</option>
		<option value="4">研究生</option>
	</select>
	<input type="button" value="复制内容" onclick="copyContent();" />
</body>
</html>