日期:2014-05-16  浏览次数:20342 次

一个javascript小问题
在form里假设有6个text,前边3个我需要往里输入值。

之后建一个radio,当我在页面选中这个radio之后,

后3个text分别显示前3个我已经输入的值。

请教1下   该怎么实现?



------解决方案--------------------
<script language= "JavaScript " type= "text/javascript ">
<!--
function $(element)
{
return document.getElementById(element);
}
function kk()
{
if($( "chk ").checked)
{
$( "t11 ").value=$( "t1 ").value;
$( "t21 ").value=$( "t2 ").value;
$( "t31 ").value=$( "t3 ").value;
}
else
{
$( "t11 ").value= " ";
$( "t21 ").value= " ";
$( "t31 ").value= " ";
}
}
//-->
</script>
</head>

<body>
<input type= "text " id= "t1 "> <br>
<input type= "text " id= "t2 "> <br>
<input type= "text " id= "t3 "> <br>
<input type= "checkbox " id= "chk " onclick= "kk(); "> 复制 <br>
<input type= "text " id= "t11 "> <br>
<input type= "text " id= "t21 "> <br>
<input type= "text " id= "t31 "> <br>
</body>