扫描条形码时打开弹出窗口

时间:2015-03-24 09:14:41

标签: php barcode barcode-scanner

我正在尝试调用js函数,当我扫描条形码时会打开一个小页面。可以实现吗?

这是我的代码:

<script>
function PopupCenter(url, title, w, h) {  

var dualScreenLeft = window.screenLeft != undefined ? window.screenLeft  :screen.left;  
var dualScreenTop = window.screenTop != undefined ? window.screenTop : screen.top;  

width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : screen.width;  
height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : screen.height;  

var left = ((width / 2) - (w / 2)) + dualScreenLeft;  
var top = ((height / 2) - (h / 2)) + dualScreenTop;  
var newWindow = window.open(url, title, 'scrollbars=yes, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left);  

//  Puts focus on the newWindow  
if (window.focus) {  
   newWindow.focus(); 
   newWindow.document.bgColor="grey"; 
   //window.opener.document.body.style.backgroundColor = "grey"; 
}  
}
</script>

<form method="post" action="action.php">
<input type="button" class="searchbutton" value="" onclick="PopupCenter('barcode.php','BARCODE',1000,500)"/>
</form>

提前致谢

0 个答案:

没有答案
相关问题