猿问

如何通过 DOM 从记录中隐藏 RESET 按钮?

谁能告诉我如何使用 DOM 隐藏 RESET 按钮?我正在尝试使用 beforeLoad 函数制作一个 uservent 脚本,该脚本将从记录中隐藏/删除 RESET 按钮。


千万里不及你
浏览 190回答 2
2回答

翻阅古今

我找到了一个解决方案:var form = ctx.form;var field = form.addField({&nbsp; id: 'custpage_code',&nbsp; type: 'inlinehtml',&nbsp; label: 'Code'});field.defaultValue = '<script>' +&nbsp; 'document.getElementById("resetter").style.display = "none";' +&nbsp; 'document.getElementById("tdbody_resetter").style.display = "none";' +// removed the extra line along the button&nbsp; '</script>';

一只斗牛犬

另一种选择是 JQuery,它已经预先加载到 NS 中。var hideFld = context.form.addField({&nbsp; &nbsp; id:'custpage_hide_buttons',&nbsp; &nbsp; label:'not shown - hidden',&nbsp; &nbsp; type: serverWidget.FieldType.INLINEHTML});var scr = "";scr += 'jQuery("#tbl_resetter").hide();';scr += 'jQuery("#print").hide();';hideFld.defaultValue = "<script>jQuery(function($){require([], function(){" + scr + ";})})</script>"你可以用这个隐藏几乎任何元素。只需在页面源中搜索元素 ID:“重置”按钮的元素通常是一个带有 ID 的表格tbl_resetter。像上面一样轻松添加多个元素。
随时随地看视频慕课网APP

相关分类

JavaScript
我要回答