获取值还好说,
赋值给另一个页面看怎么说了,
得分情况,另一个页面是在当前页面的框架下,或者同在一个框架下,还是脱离当前页面的
如果是脱离当前页面的,还得区别下怎么脱离的,
是window.open的还是showModalDialog,再或者是showModelessDialog,甚至都不是,而是超连接过去的
处理方式不一样的

解决方案 »

  1.   

    在名单页面有如下表格<table id='list'>
       <thead><tr><th>学号</th><th>姓名</th></tr></thead>
       <tbody>
          <tr><td>1</td><td>张</td></tr>
          <tr><td>2</td><td>李</td></tr>
          <tr><td>3</td><td>刘</td></tr>
          <tr><td>4</td><td>王</td></tr>
       </tbody>
    </table>
    <span id="msg"></span>
    使用JQuery的话,代码很简单$(function(){
       $("#list > tbody > tr").bind("click",function(){
          var id = $(this).find("child-nth(1)").text();
          var name = $(this).find("child-nth(2)").text();
          alert("学号:" + id + ",姓名:" + name);
          //要open一个新页面
           var url = "page.html?i=" + id + "&n=" + name
          //window.open(url);
          //要放到本页面的其他元素
           $("#msg").text("学号:" + id + ",姓名:" + name);
       });
    });
      

  2.   

    不好意思,上面代码有错,更新一下页面代码<table id='list' border="1">
       <thead><tr><th>学号</th><th>姓名</th></tr></thead>
       <tbody>
          <tr><td>1</td><td>张</td></tr>
          <tr><td>2</td><td>李</td></tr>
          <tr><td>3</td><td>刘</td></tr>
          <tr><td>4</td><td>王</td></tr>
       </tbody>
    </table>
    <span id="msg"></span>
    javascript 代码$(function(){
       $("#list > tbody > tr").bind("click",function(){
          var id = $(this).find("td:nth-child(1)").text();
          var name = $(this).find("td:nth-child(2)").text();
          alert("学号:" + id + ",姓名:" + name);
          //要open一个新页面
           var url = "page.html?i=" + id + "&n=" + name
          //window.open(url);
          //要放到本页面的其他元素
           $("#msg").text("学号:" + id + ",姓名:" + name);
       });
    });