<img onclick="callCameraFormHtml(5)" src="img/camera.png" class="camera-log scanSN"/>
function callCameraFormHtml(snkey){ //移动端系统版本判断 browser = { versions: function () { var u = navigator.userAgent, app = navigator.appVersion; return { ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), //ios终端 android: u.indexOf(‘Android‘) > -1 || u.indexOf(‘Linux‘) > -1, //android终端或uc浏览器 }; }(), language: (navigator.browserLanguage || navigator.language).toLowerCase() }; if(browser.versions.ios){ // callCameraFormHtml(snkey); // alert(1); window.location.href = ‘ios://callCameraFormHtml‘ + ‘:‘ + snkey; }else if(browser.versions.android){ window.android.callCameraFormHtml(snkey); } } function getCameraResultFromApp(snkey,snValue){ // id snKey snValue(扫码后回传的值) // 旧设备SN码: jsb-sn 1 // 新设备SN码: xsb-sn 2 // 设备SN码: sb-sn 3 // 故障机SN: gzj-sn 4 // 其他SN码: general_scan 5 if(snkey == 1){ document.getElementById("jsb-sn").value = snValue; } if(snkey == 2){ document.getElementById("xsb-sn").value = snValue; } if(snkey == 3){ document.getElementById("sb-sn").value = snValue; } if(snkey == 4){ document.getElementById("fault_SN_code").value = snValue; } if(snkey == 5){ document.getElementById("general_scan").value = snValue; } }