所有, 表單我有以下的HTML/PHP我的網頁上:打印使用jQuery
if(isset($_GET['user_id']) && $_SESSION['role']=="admin"){
$user_id = $_GET['user_id'];
}else{
$user_id = $_SESSION['user_id'];
}
?>
<button id="print_timeline" value="<?php echo $user_id; ?>">Print Timeline</button>
當我按一下按鈕我有以下的jQuery:
jQuery("#print_timeline").click(function(event){
var user_id = jQuery(this).val();
window.location.href = site_url + 'print.php/?user_id=' + user_id;
});
我試圖在不離開當前頁面的情況下打印print.php頁面,只需打開打印機屬性即可打印我的print.php頁面。在我的print.page我有以下代碼自動打印它:
<body onload="window.print()">
任何想法我可以實現這一目標?
謝謝!
這不會觸發打印彈出。 – user1048676 2012-07-11 21:15:53