<input type="Text"  aa=hehe onclick="alert(this.aa)">

解决方案 »

  1.   

    1、给分来
    <input type=text id=test other='other'>
    <button onclick="clk()">change</button>
    <script language="javascript">
      function clk(){
    test.value=test.other
    }
    </script>
    2、<table>
    <tr>
    <td><input type=text id=a1 onclick="chg()"></td>
    <td><input type=text id=b1></td>
    </tr>
    <tr>
    <td><input type=text id=a2 onclick="chg()"></td>
    <td><input type=text id=b2></td>
    </tr>
    <tr>
    <td><input type=text id=a3 onclick="chg()"></td>
    <td><input type=text id=b3></td>
    </tr>
    <tr>
    <td><input type=text id=a4 onclick="chg()"></td>
    <td><input type=text id=b4></td>
    </tr>
    <table>
    <script language='javascript'>
      function chg(){
    var id=event.srcElement.id
    document.all(id).value=idid='b'+id.substring(1,id.length)
    document.all(id).value=id
    }
    </script>
      

  2.   

    你是想手工创建这个other吗?还是程序创建呢?
    程序创建:
    <input type="text" name="test" value="测试存" onclick="yourformname.test.setAttribute('other','othervalue')">
    程序取出:
    <input type="text" name="test2" value="测试取" onclick="alert(yourformname.test.getAttribute('other'))">
      

  3.   

    问题二:
    <input type="text" name="a1" Onfocus="getFocus(this);">
    <input type="text" name="b1">
    <script>
    function getFocus(obj){
       obj.value = obj.name;
       eval("b" + obj.value.substr(1,1)).value = eval("b" + obj.value.substr(1,1)).name
    }
    </script>
      

  4.   

    总结一下:大家提供的方法基本可行,唯独rocsnake(dp) 的方法2有一点问题,就是点击a2时,b2没有反应;而a1、a3、a4都正常,奇怪啊——因为他们都用的是同一个函数,难道我的电脑有毛病?……