我正在尝试将 jpegCam 与 jquery 一起使用。我尝试使用 jquery 模态对话框打开 jpegcam 窗口,但document.write( webcam.get_html(320, 240) );
.
这是我的代码示例:
<fieldset>
<legend>scan</legend>
<table>
<tr>
<td>
<script language=\"JavaScript\">
webcam.set_api_url( 'core/img_upload/_php_upload_doc_img.php' );
webcam.set_quality( 99 ); // JPEG quality (1 - 100)
webcam.set_shutter_sound( true ); // play shutter click sound
</script>
<div id='web'>
<script language=\"JavaScript\">
document.write( webcam.get_html(320, 240) );
</script>
</div>
</td>
<td>
<script language=\"JavaScript\">
webcam.set_hook( 'onComplete', 'my_completion_handler' );
function take_snapshot() {
// take snapshot and upload to server
document.getElementById('upload_results').innerHTML = '<p>uploading...</p>';
webcam.snap();
}
function my_completion_handler(msg) {
// extract URL out of PHP output
if (msg.match(/(https\:\/\/\S+)/)) {
var image_url = RegExp.$1;
// show JPEG image in page
document.getElementById('upload_results').innerHTML =
'<img src=\"' + image_url + '\">';
// reset camera for another shot
webcam.reset();
}
else alert(\"PHP Error: \" + msg);
}
</script>
<div id=\"upload_results\" ></div>
</td>
</tr>
</table>
<div class='div_button'>
<table class='pok'>
<tr>
<form>
<input type='button' value=\"skenuj\" onClick=\"take_snapshot()\" class='web' />
<input type='button' value=\"konfigurace\" onClick=\"webcam.configure()\" class='web' />
</form>
</td>
</tr>
</table>
</fieldset>
jquery functions
$('#sc_id').dialog({
autoOpen: false,
width: 800,
modal:true,
});
$('#scan_id').click(function(){
$('#sc_id').dialog('open');
return false;
});
jpegcam 来源:webcam.js 和 webcam.swf 没有变化.....感谢任何回复.......:)