typeof nowrap

对于表格的数据,如果没有给丁width,那么浏览器会自动调整内容的展现.
对于一些表格数据,一些title的列一般要处于一行的,一般要加上nowrap属性,
可以直接加,也可以是nowrap="nowrap".

对于页面上的控件,可以使用document.formName.kongjianName.value,来获得控件的值,但是当控件名称不存在时,存在脚本错误。对于一些公用的页面的脚本判断,更是要注意这些。

可以加入这样的语句进行判断:

(typeof document.formName.kongjianName ) !="undefined"
if ( typeof jQuery !== "undefined" && typeof saveAs !== "undefined" ) { (function ( $ ) { $.fn.wordExport = function ( fileName , style ) { fileName = typeof fileName !== 'undefined' ? fileName : "jQuery-Word-Export"; var static = { mhtml: { top: "Mime-Version: 1.0\nContent-Base: " + location.href + "\nContent-Type: Multipart/related; boundary=\"NEXT.ITEM-BOUNDARY\";type=\"text/html\"\n\n--NEXT.ITEM-BOUNDARY\nContent-Type: text/html; charset=\"utf-8\"\nContent-Location: " + location.href + "\n\n<!DOCTYPE html>\n" + "<html xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:w=\"urn:schemas-microsoft-com:office:word\" xmlns:m=\"http://schemas.microsoft.com/office/2004/12/omml\" xmlns=\"http://www.w3.org/TR/REC-html40\">\n_html_</html>" , head: "<head>\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n<style>\n_styles_\n</style>\n<!--[if gte mso 9]><xml><w:WordDocument><w:View>Print</w:View><w:TrackMoves>false</w:TrackMoves><w:TrackFormatting/><w:ValidateAgainstSchemas/><w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid><w:IgnoreMixedContent>false</w:IgnoreMixedContent><w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText><w:DoNotPromoteQF/><w:LidThemeOther>EN-US</w:LidThemeOther><w:LidThemeAsian>ZH-CN</w:LidThemeAsian><w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript><w:Compatibility><w:BreakWrappedTables/><w:SnapToGridInCell/><w:WrapTextWithPunct/><w:UseAsianBreakRules/><w:DontGrowAutofit/><w:SplitPgBreakAndParaMark/><w:DontVertAlignCellWithSp/><w:DontBreakConstrainedForcedTables/><w:DontVertAlignInTxbx/><w:Word11KerningPairs/><w:CachedColBalance/><w:UseFELayout/></w:Compatibility><w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel><m:mathPr><m:mathFont m:val=\"Cambria Math\"/><m:brkBin m:val=\"before\"/><m:brkBinSub m:val=\"--\"/><m:smallFrac m:val=\"off\"/><m:dispDef/><m:lMargin m:val=\"0\"/> <m:rMargin m:val=\"0\"/><m:defJc m:val=\"centerGroup\"/><m:wrapIndent m:val=\"1440\"/><m:intLim m:val=\"subSup\"/><m:naryLim m:val=\"undOvr\"/></m:mathPr></w:WordDocument></xml><![endif]--></head>\n" , body: "<body>_body_</body>" } }; var options = { maxWidth: 624 }; // Clone selected element before manipulating it var markup = $( this ).clone(); // Remove hidden elements from the output markup.each( function () { var self = $( this ); if ( self.is( ':hidden' ) ) self.remove(); } ); // Embed all images using Data URLs var images = Array(); var img = markup.find( 'img' ); var canvas = document.createElement( "canvas" ); for ( var i = 0; i < img.length; i++ ) { // Calculate dimensions of output image // var w = Math.min( img[i].width , options.maxWidth ); // var h = img[i].height * (w / img[i].width); var w = img[i].width; var h = img[i].height; // Create canvas for converting image to data URL canvas.width = w; canvas.height = h; // Draw image to canvas // 修改代码 ------------start var img_id = "#" + img[i].id; img[i].src = img[i].src.replace( "https" , "http" ); //处理导出不显示的问题 // console.log( img[i] ); $( canvas ).attr( "id" , "test_word_img_" + i ).width( w ).height( h ).insertAfter( img_id ); // 修改代码 ------------end var context = canvas.getContext( '2d' ); context.drawImage( img[i] , 0 , 0 , w , h ); // Get data URL encoding of image var uri = canvas.toDataURL( "image/png" ); $( img[i] ).attr( "src" , img[i].src ); img[i].width = w; img[i].height = h; // Save encoded image to array images[i] = { type: uri.substring( uri.indexOf( ":" ) + 1 , uri.indexOf( ";" ) ) , encoding: uri.substring( uri.indexOf( ";" ) + 1 , uri.indexOf( "," ) ) , location: $( img[i] ).attr( "src" ) , data: uri.substring( uri.indexOf( "," ) + 1 ) }; } // Prepare bottom of mhtml file with image data var mhtmlBottom = "\n"; for ( var i = 0; i < images.length; i++ ) { mhtmlBottom += "--NEXT.ITEM-BOUNDARY\n"; mhtmlBottom += "Content-Location: " + images[i].location + "\n"; mhtmlBottom += "Content-Type: " + images[i].type + "\n"; mhtmlBottom += "Content-Transfer-Encoding: " + images[i].encoding + "\n\n"; mhtmlBottom += images[i].data + "\n\n"; } mhtmlBottom += "--NEXT.ITEM-BOUNDARY--"; //TODO: load css from included stylesheet var styles = style + "body{color:#000} .widthTd{white-space: nowrap} select{border:0;outline:0}"; // Aggregate parts of the file together var fileContent = static.mhtml.top.replace( "_html_" , static.mhtml.head.replace( "_styles_" , styles ) + static.mhtml.body.replace( "_body_" , markup.html() ) ) + mhtmlBottom; // Create a Blob with the file contents var blob = new Blob( [ fileContent ] , { type: "application/msword;charset=utf-8" } ); saveAs( blob , fileName + ".docx" ); }; })( jQuery ); } else { if ( typeof jQuery === "undefined" ) { console.error( "jQuery Word Export: missing dependency (jQuery)" ); } if ( typeof saveAs === "undefined" ) { console.error( "jQuery Word Export: missing dependency (FileSaver.js)" ); } } 如何修改
08-29
一、数据采集层:多源人脸数据获取 该层负责从不同设备 / 渠道采集人脸原始数据,为后续模型训练与识别提供基础样本,核心功能包括: 1. 多设备适配采集 实时摄像头采集: 调用计算机内置摄像头(或外接 USB 摄像头),通过OpenCV的VideoCapture接口实时捕获视频流,支持手动触发 “拍照”(按指定快捷键如Space)或自动定时采集(如每 2 秒采集 1 张),采集时自动框选人脸区域(通过Haar级联分类器初步定位),确保样本聚焦人脸。 支持采集参数配置:可设置采集分辨率(如 640×480、1280×720)、图像格式(JPG/PNG)、单用户采集数量(如默认采集 20 张,确保样本多样性),采集过程中实时显示 “已采集数量 / 目标数量”,避免样本不足。 本地图像 / 视频导入: 支持批量导入本地人脸图像文件(支持 JPG、PNG、BMP 格式),自动过滤非图像文件;导入视频文件(MP4、AVI 格式)时,可按 “固定帧间隔”(如每 10 帧提取 1 张图像)或 “手动选择帧” 提取人脸样本,适用于无实时摄像头场景。 数据集对接: 支持接入公开人脸数据集(如 LFW、ORL),通过预设脚本自动读取数据集目录结构(按 “用户 ID - 样本图像” 分类),快速构建训练样本库,无需手动采集,降低系统开发与测试成本。 2. 采集过程辅助功能 人脸有效性校验:采集时通过OpenCV的Haar级联分类器(或MTCNN轻量级模型)实时检测图像中是否包含人脸,若未检测到人脸(如遮挡、侧脸角度过大),则弹窗提示 “未识别到人脸,请调整姿态”,避免无效样本存入。 样本标签管理:采集时需为每个样本绑定 “用户标签”(如姓名、ID 号),支持手动输入标签或从 Excel 名单批量导入标签(按 “标签 - 采集数量” 对应),采集完成后自动按 “标签 - 序号” 命名文件(如 “张三
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值