注册 登录
编程论坛 ASP技术论坛

请问这个代码怎么修改

zzzhhhyyy 发布于 2009-08-02 13:26, 331 次点击
<html>
<body>
<script language="javascript" type="text/javascript">
function go(){
 var A=get('A');
 var A_value=get('A_value');
 A.value=A_value.value;
 
}
function get(str){
 return document.getElementById(str);
}
</script>

<form>
  <p>●:
     A
<input type="text" id="A_value" style=" height:20; width:20"/>

</p>
  <p>
    <input type="BUTTON" value="确定查看" onClick="go()" >
  </p>
  <p>====================================================</p>

  <p> ①:
    A
    <input type="text" id="A" style=" height:20; width:20"/>
    </p>
  <p>②:
    A
    <input type="text" id="A" style=" height:20; width:20"/>
    </p>
  <p>③:
    A
    <input type="text" id="A" style=" height:20; width:20"/>
    </p>
      <p>④:
     A
    <input type="text" id="A" style=" height:20; width:20"/>
     </p>
      <p>⑤:
     A
    <input type="text" id="A" style=" height:20; width:20"/>
     </p>
</form>
</body>
</html>
*****************************************************************************
在●:A框填入“1”
点击(确定查看)
下面的①A框里就能显示“1”
问题是:①A框能显示;
        ②③④⑤A框都显示不了???

现在就是要①A框②A框③A框④A框⑤A框;都能显示填入●:A框的数字

谁能教教我 谢谢啦!!!
3 回复
#2
aspic2009-08-02 16:23
id不建议重复 id重复了那怎么判断呢?
#3
aspic2009-08-02 16:29
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.
<html xmlns="http://www.
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script language="javascript">
var $ = function(ID){return document.getElementById(ID);}
get = function(){
    $('A1').value = $('A2').value = $('A3').value = $('A4').value = $('A5').value =$('A_value').value;    
}
</script>
</head>

<body>
<form>
    <p>●:A<input type="text" id="A_value" style=" height:20; width:20"/></p>
    <p><input type="BUTTON" value="确定查看" onClick="get()" ></p>
    <p>====================================================</p>
    <p>①:A<input type="text" id="A1" style=" height:20; width:20"/></p>
    <p>②:A<input type="text" id="A2" style=" height:20; width:20"/></p>
    <p>③:A<input type="text" id="A3" style=" height:20; width:20"/></p>
    <p>④:A<input type="text" id="A4" style=" height:20; width:20"/></p>
    <p>⑤:A<input type="text" id="A5" style=" height:20; width:20"/></p>
</form>
</body>
</html>
#4
zzzhhhyyy2009-08-03 18:06
非常感谢!!!!!!!!!!!!!!!!
1