【问题标题】:window.open for printing and call a field through databasewindow.open 用于打印并通过数据库调用字段
【发布时间】:2013-07-06 07:05:34
【问题描述】:

对不起,我没有这个问题的具体标题,

我想用 window.open 方法打印一个表单,这是一段脚本:

<?php
include "connect.php";

$test = mysql_query("select * from dataorder order by idorder desc limit 1 ");


if (!test)
die ("Error... " .mysql_error());

while ($row = mysql_fetch_array ($test))
{
echo "ID number   : $row[idorder] <br/><br/>";
echo "Name        : $row[name] <br/><br/>";  
echo "<div>";
echo "<input  type=button name=back    value='back'onClick='parent.location='reserve.php''>";   
echo '<input  type="submit"
          class="btn btn-success"
          name="print" value="print"
       onClick="window.open("print.php?idorder="'.$row['idorder'].'","scrollwindow","top=200,left=350,width=680px,height=500")" 
        style="text-decoration:none">';
echo "</div>";
}
?>

“打印”按钮可以出现,但点击时无响应。

【问题讨论】:

    标签: php click row window.open


    【解决方案1】:

    我认为您有多个引用问题(加上空格问题)导致 onClick 无法正常工作 -

    echo "<input  type=button name=back    value='back'onClick='parent.location='reserve.php''>"; 
                      ^      ^    ^    ^              ^                                      ^
    echo '<input  type="submit"
          class="btn btn-success"
          name="print" value="print"
       onClick="window.open("print.php?idorder="'.$row['idorder'].'","scrollwindow","top=200,left=350,width=680px,height=500")"
                            ^                  ^                   ^ ^            ^ ^                                       ^ 
        style="text-decoration:none">';
    

    试试这样的 -

    echo '<input type="button" name="back" value="back" onClick="parent.location=\'reserve.php\'">';   
    echo '<input type="submit" class="btn btn-success" name="print" value="print"
           onClick="window.open(\'print.php?idorder='.$row['idorder'].'\',\'scrollwindow\',\'top=200,left=350,width=680px,height=500\')" 
        style="text-decoration:none">';
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-03-24
      相关资源
      最近更新 更多