1.html<!doctype html>
<html lang="en">
 <head>
  <meta charset="UTF-8">
  <meta name="Generator" content="EditPlus®">
  <meta name="Author" content="">
  <meta name="Keywords" content="">
  <meta name="Description" content="">
  <title>Document</title>
 </head>
 <body>
<table id=table>
<tr><td id="1">1111</td><td><input type="button" value="show" onclick="window.showModalDialog('2.html',window)"/></td></tr>
<tr><td id="2">2222</td><td><input type="button" value="show" onclick="window.showModalDialog('2.html',window)"/></td></tr>
</table>
 </body>
</html>2.html<!doctype html>
<html lang="en">
 <head>
  <meta charset="UTF-8">
  <meta name="Generator" content="EditPlus®">
  <meta name="Author" content="">
  <meta name="Keywords" content="">
  <meta name="Description" content="">
  <title>Document</title>
 </head>
 <body>
  <input type=button value="alert" onclick="a()"/>
 </body>
 <script>
function a(){
alert(window.dialogArguments.document.getElementById('1').innerHTML);
}
 </script>
</html>

解决方案 »

  1.   

    @MengYouXuanLv
    忘了说了,父页面的table的tr中有从1开始递增的NO,后面会有一个td里有一个查询条件userId。我想的是点击“查看下一条”button后,取到下一个tr里面的NO后再找到所在行的userId,在进行查询
      

  2.   

    1.html<!doctype html>
    <html lang="en">
     <head>
      <meta charset="UTF-8">
      <meta name="Generator" content="EditPlus®">
      <meta name="Author" content="">
      <meta name="Keywords" content="">
      <meta name="Description" content="">
      <title>Document</title>
     </head>
     <body>
    <table id=table>
    <tr><td>1111</td><td><input type="button" value="show" onclick="pop(this)"/></td></tr>
    <tr><td>2222</td><td><input type="button" value="show" onclick="pop(this)"/></td></tr>
    <tr><td>3333</td><td><input type="button" value="show" onclick="pop(this)"/></td></tr
    <tr><td>4444</td><td><input type="button" value="show" onclick="pop(this)"/></td></tr
    <tr><td>5555</td><td><input type="button" value="show" onclick="pop(this)"/></td></tr
    <tr><td>6666</td><td><input type="button" value="show" onclick="pop(this)"/></td></tr
    </table>
     </body>
     <script>
    function pop(btn){
    var obj = {parent:window,
       tr:btn.parentNode.parentNode,//tr
       table:document.getElementById("table")
      }
    window.showModalDialog('2.html',obj);
    }
     </script>
    </html>2.html<!doctype html>
    <html lang="en">
     <head>
      <meta charset="UTF-8">
      <meta name="Generator" content="EditPlus®">
      <meta name="Author" content="">
      <meta name="Keywords" content="">
      <meta name="Description" content="">
      <title>Document</title>
     </head>
     <body>
      <label id='lbl'></label>
      <input type=button value="next" onclick="next()"/>
     </body>
     <script>
    var lbl = document.getElementById('lbl'),
        wParent = window.dialogArguments.parent,
    table = window.dialogArguments.table
    tr = window.dialogArguments.tr;
    lbl.innerHTML = tr.childNodes[0].innerHTML;
    function next(){
    tr = table.rows[tr.rowIndex + 1];
    lbl.innerHTML = tr.childNodes[0].innerHTML;
    }
     </script>
    </html>