把你做的代码帖出来一部分,呵呵.其实简单点可以不弹出页面,如果弹出页面的话,需要调用父页面 window.parent 或者window.opener
弹出一个层的话可能更好处理一些,这样只处理当前页面.

解决方案 »

  1.   

    把你做的代码帖出来一部分,呵呵.其实简单点可以不弹出页面,如果弹出页面的话,需要调用父页面 window.parent 或者window.opener
    弹出一个层的话可能更好处理一些,这样只处理当前页面.
      

  2.   

    这个是点击A页面文本框弹出的画面<?php 
    include("../db/dbconnect.php");//连接数据库///////////////////////////////////////以下是查詢分頁
    $sql="select _roominfo.roomno,_roominfo.location,_bedinfo.*  from _roominfo,_bedinfo where _roominfo.id=_bedinfo.rid and occuption='".$no."'";   //联表查询
    $result=mysql_query($sql);       $pagesize=10;//每页10条记录       $total=mysql_num_rows($result);  
           $filename="roominfoselect.php?";
     
           $currpage=intval($_REQUEST["page"]);
        if(!is_int($currpage))
         $currpage=1;
     if(intval($currpage)<1)$currpage=1;
       if(intval($currpage-1)*$pagesize>$total)$currpage=1;
        if(($total%$pagesize)==0)
        {
         $totalpage=intval($total/$pagesize);
       
        }
        else
         $totalpage=intval($total/$pagesize)+1;
      if ($total!=0&&$currpage>1)
           mysql_data_seek($result,(($currpage-1)*$pagesize));       $i=0;
    ///////////////////////////////////////////////////////////////////////////////////////
     
     ?>
    <style type="text/css">
    <!--
    .STYLE3 {font-size: x-small}
    .STYLE4 {font-size: x-small; color: #0000FF; }
    -->
    </style>
    <body bgcolor="#d4d0c8"><style type="text/css">
    <!--
    .STYLE2 {font-size: x-small}
    -->
    </style><form name="room_form" method="post" action="../staff/Basicinfo.php?action=add"  >
      <table width="314" height="94" border="1" cellpadding="0" cellspacing="0">
        <tr>
          <td height="27" colspan="4"><div align="center"><strong>可入住房間床號資料</strong></div><A href="#" onClick="uu()"></A></td>
        </tr>
        <tr>
          <td height="21" colspan="4"><div align="center" class="STYLE4">請勾選複選框點擊確定!</div></td>
        </tr>
        <tr >
          <td height="21" colspan="2"><label></label>        <div align="center">房間號</div></td>
          <td colspan="2"><label>
            <div align="center">床號</div>
          </label></td>
        </tr>
    <?php while($row=mysql_fetch_array($result))
    {
    $i++;
         if($i>$pagesize)break;   


    ?>
        <tr onMouseOver=this.style.backgroundColor='#000000' onMouseOut=this.style.backgroundColor=''>
          <td width="20" height="23"><input type="checkbox" name="txtid[]" value="<? echo $row['id']; ?>"></td>
          <td width="106"><label>
            <input id="txtroomno" name="txtroomno" type="text" size="15" value="<? echo $row['roomno']; ?>" readonly="" >
          </label></td>
          <td width="108"><input id="txtbedno" name="txtbedno" type="text" size="15" value="<? echo $row['bedno']; ?>" readonly=""></td>
          <td width="70"><input type="submit" name="oper2" value="確定" onClick="ref()" ></td>
        </tr>
    <? } ?>
     </table>
    </form><!-- 这里插入分页的页脚,插入while之后,一般可以在</table>下边-->
    <form method="post" action="<?php echo $filename;?>"> 
    <span class="STYLE3">共
    <?php  echo $total;?>
    个记录&nbsp;<?php 
     if($currpage==1){
      ?>
    首页&nbsp;上一页&nbsp;
    <?php
     } else {
     ?>
    <a href=<?php echo $filename;?>page=1>首页</a>&nbsp;<a href=<?php echo $filename;?>page=<?php echo ($currpage-1);?>>上一页</a>&nbsp;
    <?php }if($currpage==$totalpage){
      ?>
    下一页&nbsp;尾页&nbsp;
    <?php }else{?><a href=<?php echo $filename;?>page=<?php echo ($currpage+1);?>>下一页</a>&nbsp;<a href=<?php echo $filename;?>page=<?php echo  $totalpage;?>>尾页</a>&nbsp;<?php }?>
    </span>
    <select name='page' size='1' onchange='javascript:submit()' action='<?php echo $filename;?>'> 
    <?php
       for($i=1;$i<=$totalpage;$i++)
       {
    ?>
     <option value=<?php echo $i; ?>
       <?php 
        if ($currpage==$i)
               echo "selected"; 
       ?>>
    第<?php echo $i;?>页</option>  <?php }?>
    </select>
    </form></body>
      

  3.   

    这就是A页面,也就是画面里的提交按扭所提交的页面//注意上楼画面提交的action,便于理解就当成A页面
    <?php 
    $oper2=$_POST['oper2'];
    $id=$_POST['txtid'];
    if($oper2=="確定"){if($id!="")
       {
           $count=count($id);
       if($count>=2)
       {
         echo"<script>alert('對不起,您只能勾選一個!');location.href='roominfoselect.php';</script>";
       }else
       {
          
      for($i=0;$i<$count;$i++)
      {
        $sql3="select *   from _roominfo,_bedinfo where _roominfo.id=_bedinfo.rid and    _bedinfo.id='$id[$i]'";
      $_SESSION['bid']=$id[$i];
      }

    $rs3=mysql_query($sql3);
    $row3=mysql_fetch_array($rs3);

    $_SESSION['roomno']=$row3['roomno'];
    $_SESSION['bedno']=$row3['bedno'];

    echo $_SESSION['bid'];    //点击确定选择从数据库查到的id,房号和床号保存在
    echo $_SESSION['roomno'];  //session里
    echo $_SESSION['bedno'];


               


       }
         
       }else
       {
         echo"<script>alert('對不起,您還沒有勾選資料!');location.href='roominfoselect.php';</script>";
       }
    }
    ?>
    //JS脚本点击文本框时打开固定大小画面,就是上楼的画面
    <script language="javascript" type="text/javascript" >
    function room()
    {
      window.open("../room/roominfoselect.php","_blank", "width=350,height=400,toolbar=no");
    }</script>
    <table>
     <tr>
          <td 入宿房號</td>
          <td ><input id="txtrid" name="txtrid" type="text" size="15" onclick="room()" /></td>
          <td >入宿床號</td>
          <td ><input id="txtbid" name="txtbid" type="text" size="15" onclick="room()" /></td>
     </tr></table>
      

  4.   

    现在要求的是点击A页面文本框弹出画面选择一条记录把ID传到A页面,同时让A页面文本框里显示所选择的内容,就是值!好像只有AJAX用层可以做,望大家给个例子,我再把分加一下,多谢!
      

  5.   

    传值的时候要A页面直接接收显示,不要新跳一个页面出来,我用SESSION传过去只能是提交过去新打开A页面,原来的A页面还在但没接收到值,新打开的A页面接收到session值但其它本己填好的数据又刷没了!
      

  6.   

    打开一个固定的窗口,在两个窗口之间进行个传值要用到
    比如  :点A页连接到B
    A页面:  
    <script>
       a(v){
         alert(v);
       }
    </script>
    第二个页面B:
    <script>
      b(){
      window.opener.a('as');//调用父级的 JS  函数
    }
    </script>
    <Td onclick="b();">C</td>
      

  7.   

    lz看看这本书怎么样
    http://download.csdn.net/source/812902
      

  8.   

    比如你想得到的值已经在B面可以  得到.比如  i
    你可以把   window.opener.a(<?php echo i?>);
    就可以了
      

  9.   

    用jquery做的,呵呵.
    <html> 
    <head> 
    <title>test</title> 
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 
    <script language="javascript" src="./jquery/libs/jquery.js"></script> 
    <script language="javascript"> 
     jQuery(function($)
     {
       $('#test').click(function(){
       
        var oMsg = $('#tmsg');
        var oDiv = $('#msg');
       
        oDiv.css('zindex', 100);
        oDiv.show('slow');
       
        //ajax获取数据
        $.ajax({
          type: 'post',
          url: 'getData.php',
          dataType: 'json',
          success: function(jsonText){
            var length  = jsonText.length;
            
            var objTable = document.getElementById('tmsg');   
            var objTbody = objTable.childNodes[0]; 
            var objTR = objTbody.childNodes[1];     
            //置空数据
            for(var i=objTbody.childNodes.length-1;i>1 ;i--)
            {
              objTbody.removeChild(objTbody.childNodes[i]);
            }      
            
            for(var i=0;i<length;i++)
            {
              var tmpTR = objTR.cloneNode(true);         
              objTbody.appendChild(tmpTR);
              tmpTR.style.display = "";
              var tmpID = tmpTR.childNodes[0].innerHTML;
              
              tmpID =  tmpID.replace(/{id}/ig,jsonText[i].id);
              tmpID =  tmpID.replace(/{name}/ig,jsonText[i].name);
              tmpID =  tmpID.replace(/{card}/ig,jsonText[i].card);        
              tmpTR.childNodes[0].innerHTML = tmpID;
              tmpTR.childNodes[1].innerHTML = jsonText[i].name;
              tmpTR.childNodes[2].innerHTML = jsonText[i].card;
            }  
            
            $('.aTD').each(function(){
              $(this).click(function(){
                var arrCard = this.id.split("_");
                $('#test')[0].value = arrCard[1] + "_" + arrCard[2];
                oDiv.hide('slow');
              });
            });
          },//success
          error: function(xmlHttp, message, code){
            alert(message);
          }//error
        });//ajax
        
       });
     })//jquery
    </script> 
    </head> 
    <body>  
    <form action='sendinfo.php' name="user_info" method='post' enctype="multipart/form-data" onsubmit="return saveUserInfo();"> 
    <input type='text' name='test' id='test' value="">
    </form> 
    <div id="msg" style="display:none;position: absolute;background-color:#fff1e1;border:1px black solid;padding: 10px;">
     <table border='1' id='tmsg'><tr><td width='100'>id</td><td width='200'>解行卡</td><td width='200'>银行名称</td></tr><tr style='display:none'><td id='id' width='100'><a class='aTD' id='{id}_{name}_{card}' href='javascript:///'>{id}</a></td><td width='200'>{name}</td><td width='200'>{card}</td></tr></table>
    </div> 
    </body> 
    </html>[code][code=PHP]<?php
    header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
    header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
    header("Cache-Control: no-store, no-cache, must-revalidate");
    header("Cache-Control: post-check=0, pre-check=0", false);
    header("Pragma: no-cache");//从一维数组中生成josn
    function __jsonText($array)
    {
       $str = "{";
       foreach($array as $key=> $value)
       {
          $value = str_replace("\"", "\\\"", $value);
          if($str != "{") $str.=",";
          $str .= "$key: " . "\"$value\"";
       }
       $str .= "}";   return $str;
    }$arrCard = array(
        array('id'=>'1', 'name'=>'中国银行', 'card'=>'中国银行卡'),
        array('id'=>'2', 'name'=>'工商银行', 'card'=>'工商银行卡'),
        array('id'=>'3', 'name'=>'建设银行', 'card'=>'建设银行卡'),
        array('id'=>'4', 'name'=>'农业银行', 'card'=>'农业银行卡'),
      );
     
    $strJson = ""; 
    foreach($arrCard as $key=>$value)
    {
    $strJson .= __jsonText($value) . ",";
    }
    echo sprintf('[%s]', rtrim($strJson, ','));
    ?>
      

  10.   

    从数据库读出来的数据放在文本框value里用脚本取,是不是取不到呀,document.all.txta.value取出来显示的是undefined,有什么方法可以取到真实的值吗?
      

  11.   

    这是显示的效果!可以说下14楼的问题吗?点击时先弹出上面这个error
    然后接着显示下面这个
      

  12.   

    <input type='text' name='test' id='test' value="">
    取值可以这样取
    <script language='javascript'>
     alert(document.getElementById('test').value);
    </script>
      

  13.   

    开始这样写赋给txtrid,txtbid的值取出是undefineddocument.getElementById("txtrid").value=document.room_form.txtroomno.value;
    document.getElementById("txtbid").value=document.room_form.txtbedno.value;现在改成这样但只取到第一个
    document.getElementById("txtrid").value=document.getElementById("txtroomno").value;
    document.getElementById("txtbid").value=document.getElementById("txtbedno").value;
    因为txtroomno,txtbedno的值是从数据库循环取出来的,name又是一样的,估计还是要用循环取.有问题再请教了!
      

  14.   

       
    <script>function roombed(){ for(var i=0;i<=document.getElementById("txtid").length;i++)
    {

              if(document.getElementById("txtid")[i].checked==true)
               {
         
    document.getElementById("txtrid").value=document.getElementById("txtroomno")[i].value;
    document.getElementById("txtbid").value=document.getElementById("txtbedno")[i].value;
                        
                }
     else
       {
          alert("error error error !");
       }
           }
              }
    </script>
    //这里的值是从数据库里取出的 <input type="checkbox" id="txtid" name="txtid[]" value="<? echo $row['id']; ?">//复选框
         
     <input id="txtroomno" name="txtroomno[]" type="text" size="15" value="<? echo $row['roomno']; ?>" >
          
     <input id="txtbedno" name="txtbedno[]" type="text" size="15" value="<? echo $row['bedno']; ?>" > <input id="txtrid" name="txtrid" type="text">
     <input id="txtbid" name="txtbid" type="text">     <input type="submit" name="oper2" value="確定" onClick="roombed()" >现在就是当我点击确定的时候要把从数据库循环取出的值分别显示在txtrid,txtbid里,并且是先选中了一个复选框,以上JS代码没取到,请教了!