douwen5924 2016-06-10 15:05
浏览 52
已采纳

循环时将数据通过JavaScript传递到弹出页面

I need to know how to pass the date while loop through JavaScript to a popup page and put it inside a <P> tag on the popup window?

<div class="header-img" align="center">

<img src="header.png" width="300">

</div>
<div class="maincontent" align="right">
<?php
include 'config.php';

$con->set_charset('utf8');
$sql = "SELECT * FROM de40v_subventions order by id desc";
$names = mysqli_query($con,$sql);
while($row = mysqli_fetch_array ($names)){


?>
<table class="maintable" align="right" width="400px" dir="rtl"> 
<form name="form" method="post" action="delconfirm.php" onSubmit="return checknone();">
<tr>
<td> <label> <b>الرقم: </b> </label> </td>
<td> <input type="text" value="<?php echo $row['id'] ?>" class="inputid" readonly/> </td>
</tr>
<tr>
<td> <label> <b>التاريخ والوقت: </b> </label> </td>
<td> <p> <?php echo date("Y-m-d H:m:s" , $row['datetime']); ?> </p> </td>
</tr>
<tr>
<td> <label> <b> الإسم كاملاً:</b> </label> </td>
<td> <p id="name"> <?php echo $row['firstname'] . ' ' . $row['fathername'] . ' ' . $row['grandfathername'] . ' ' . $row['familyname'] ?> </p> </td>
</tr>
<tr>
<td> <label> <b> رقم الهوية:</b> </label> </td>
<td> <p id="identity"> <?php echo $row['identity'] ?> </p> </td>

.........


<script type="text/JavaScript">

function openprint(){

    var popupwin = window.open("","طباعة البيانات","width=700, height=400");

    popupwin.document.writeln('<html><head><title>طباعة البيانات</title></head> <body> <center> <p id="printname"></p> </center> </body> </html>');
    popupwin.document.close();
    popupname = popupwin.document.getElementById('printname').innerHTML;
    name = document.getElementById('name').innerHTML;
    popupname = name;

}

<?php } ?>
  • 写回答

1条回答 默认 最新

  • douba05167 2016-06-10 15:56
    关注

    Actually something is showing up on your popup page, you just haven't passed any actual visible content there. Try this:

    popupwin.document.getElementById('printname').innerHTML = 'put your date or content here';
    

    And place it just after your writeln() call.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示
  • ¥15 求三国群英传pl国战时间的修改方法
  • ¥15 matlab代码代写,需写出详细代码,代价私
  • ¥15 ROS系统搭建请教(跨境电商用途)
  • ¥15 AIC3204的示例代码有吗,想用AIC3204测量血氧,找不到相关的代码。
  • ¥20 CST怎么把天线放在座椅环境中并仿真
  • ¥15 任务A:大数据平台搭建(容器环境)怎么做呢?