第1个回答 2013-06-13
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Untitled</title>
</head>
<script>
function test(){
document.getElementById("p1").value= document.getElementById("s1").innerHTML;
document.getElementById("p2").value= document.getElementById("s2").innerHTML;
}
</script>
<body>
<div>名称:<span id="s1">rs("username")</span></div>
<div>等级:<span id="s2">rs("dengji")</span></div>
<div><input type="button" onclick="test();" value="填入文本框>>"></div>
<div><input type="text" id="p1"/></div>
<div><input type="text" id="p2"/></div>
</body>
</html>