日期:2014-05-17  浏览次数:20762 次

onclick value 问题
<input   id= "outputs2 "   name= "ap1 "   type= "text "   value= " "   size=15>

<input   id= "outputs3 "   name= "ap2 "   type= "text "   value= " "   size=15   >

<br> <br> <br>
<input   onclick= "outputs2.value= 'A ' "   type=button   value= "A "   >
<input   onclick= "outputs2.value= 'B ' "   type=button   value= "B "   >
<input   onclick= "outputs2.value= 'C ' "   type=button   value= "C ">

只能修改ap1的值,光标放在   ap2   那里,就修改ap2的值,光标放在   ap1   那里,就修改ap1的值如何实现?

------解决方案--------------------
<input id= "outputs2 " name= "ap1 " type= "text " value= " " size=15 onfocusout= "temp.value= '1 ' ">

<input id= "outputs3 " name= "ap2 " type= "text " value= " " size=15 onfocusout= "temp.value= '2 ' ">
<input id= "temp " type= "hidden " value= " ">

<br> <br> <br>
<input onclick= "SetValue(this,temp.value) " type=button value= "A " >
<input onclick= "SetValue(this,temp.value) " type=button value= "B " >
<input onclick= "SetValue(this,temp.value) " type=button value= "C ">
<script language= "javascript ">
function SetValue(button,ap)
{
switch (ap)
{
case "1 ":
outputs2.value=button.value
break;
case "2 ":
outputs3.value=button.value
break;
default:
outputs2.value= " "
outputs3.value= " "
break;
}
}
</script>