kk Blog —— 通用基础


date [-d @int|str] [+%s|"+%F %T"]
netstat -ltunp
sar -n DEV 1

动态设置select2

https://select2.org/programmatic-control/add-select-clear-items

https://blog.csdn.net/qq_38776922/article/details/78849069

https://blog.csdn.net/u012374381/article/details/72629233

https://www.cnblogs.com/makalochen/p/13229472.html

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<script>
function select_iframe(pre1, pid, pre2, sid, m)
{
	prr = pid.split(',');
	srr = sid.split(',');
	for (var i = 0; i < prr.length; i ++) {
		var ttype = parent.document.getElementById(pre1+'_'+prr[i]).type;
		if (ttype == 'select-one') {
			var ops = parent.document.getElementById(pre1+'_'+prr[i]).children;
			var html = document.getElementById(pre2+'_'+srr[i]).innerHTML;
			for (oi = 0; oi < ops.length; oi ++) {
				if (ops[oi].text == html) {
					// parent.document.getElementById(pre1+'_'+prr[i]).options[oi].selected = true;
					// ops[oi].selected = true;
				//    $(parent.document).find('#'+pre1+'_'+prr[i]).val(ops[oi].value).trigger('change');
					$('#'+pre1+'_'+prr[i], window.parent.document).val(ops[oi].value).trigger('change');
					var show_id = $('#select2-'+pre1+'_'+prr[i]+"-container", window.parent.document)[0];
					if (typeof(show_id) != "undefined") {
						show_id.title = ops[oi].text;
						show_id.innerText = ops[oi].text;
					}
					break;
				}
			}
		} else if (ttype == 'textarea') {
			parent.document.getElementById(pre1+'_'+prr[i]).innerHTML = document.getElementById(pre2+'_'+srr[i]).innerHTML;
			parent.document.getElementById(pre1+'_'+prr[i]).value = document.getElementById(pre2+'_'+srr[i]).innerHTML;
		} else {
			parent.document.getElementById(pre1+'_'+prr[i]).value = document.getElementById(pre2+'_'+srr[i]).innerHTML;
		}
	}
	if (m == '2') {
		parent.document.getElementById("popup").style.display = "none";
	}
}
</script>

iframe弹窗--子页面


序号字段名显示中文名排序值选择
1ZGFL管理人员11111
2ZGFL高层管理22222
3ZGFL中层管理33333
4ZGFL基层管理44444
5ZGFL专业技术类55555
















1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<script>
function select_iframe(pre1, pid, pre2, sid, m)
{
	prr = pid.split(',');
	srr = sid.split(',');
	for (var i = 0; i < prr.length; i ++) {
		var ttype = parent.document.getElementById(pre1+'_'+prr[i]).type;
		if (ttype == 'select-one') {
			var ops = parent.document.getElementById(pre1+'_'+prr[i]).children;
			var html = document.getElementById(pre2+'_'+srr[i]).innerHTML;
			for (oi = 0; oi < ops.length; oi ++) {
				if (ops[oi].text == html) {
					// parent.document.getElementById(pre1+'_'+prr[i]).options[oi].selected = true;
					// ops[oi].selected = true;
				//    $(parent.document).find('#'+pre1+'_'+prr[i]).val(ops[oi].value).trigger('change');
					$('#'+pre1+'_'+prr[i], window.parent.document).val(ops[oi].value).trigger('change');
					var show_id = $('#select2-'+pre1+'_'+prr[i]+"-container", window.parent.document)[0];
					if (typeof(show_id) != "undefined") {
						show_id.title = ops[oi].text;
						show_id.innerText = ops[oi].text;
					}
					break;
				}
			}
		} else if (ttype == 'textarea') {
			parent.document.getElementById(pre1+'_'+prr[i]).innerHTML = document.getElementById(pre2+'_'+srr[i]).innerHTML;
			parent.document.getElementById(pre1+'_'+prr[i]).value = document.getElementById(pre2+'_'+srr[i]).innerHTML;
		} else {
			parent.document.getElementById(pre1+'_'+prr[i]).value = document.getElementById(pre2+'_'+srr[i]).innerHTML;
		}
	}
	if (m == '2') {
		parent.document.getElementById("popup").style.display = "none";
	}
}
</script>

<br>

<table border='1' style="border-collapse: collapse;" table-layout='fixed' id='tb_zzdmk_98' width='98%' >
<thead>
<tr>
	<th>序号</th><th>字段名</th><th>显示中文名</th><th>排序值</th><th>选择</th>
</tr>
</thead>
<tr ondblclick="select_iframe('zzfl_id', 'zgfl,sortid', 'zzdmk_668', 'zwm,sortid', '2')" ><td>1</td><td id='zzdmk_668_pbf'>ZGFL</td><td id='zzdmk_668_zwm'>管理人员</td><td id='zzdmk_668_sortid'>11111</td><td><input style='width:70%;height:70%;' type='radio' name='radio_iframe' onclick="select_iframe('zzfl_id', 'zgfl,sortid', 'zzdmk_668', 'zwm,sortid', '1')"></td></tr>
<tr ondblclick="select_iframe('zzfl_id', 'zgfl,sortid', 'zzdmk_669', 'zwm,sortid', '2')" ><td>2</td><td id='zzdmk_669_pbf'>ZGFL</td><td id='zzdmk_669_zwm'>高层管理</td><td id='zzdmk_669_sortid'>22222</td><td><input style='width:70%;height:70%;' type='radio' name='radio_iframe' onclick="select_iframe('zzfl_id', 'zgfl,sortid', 'zzdmk_669', 'zwm,sortid', '1')"></td></tr>
<tr ondblclick="select_iframe('zzfl_id', 'zgfl,sortid', 'zzdmk_670', 'zwm,sortid', '2')" ><td>3</td><td id='zzdmk_670_pbf'>ZGFL</td><td id='zzdmk_670_zwm'>中层管理</td><td id='zzdmk_670_sortid'>33333</td><td><input style='width:70%;height:70%;' type='radio' name='radio_iframe' onclick="select_iframe('zzfl_id', 'zgfl,sortid', 'zzdmk_670', 'zwm,sortid', '1')"></td></tr>
<tr ondblclick="select_iframe('zzfl_id', 'zgfl,sortid', 'zzdmk_671', 'zwm,sortid', '2')" ><td>4</td><td id='zzdmk_671_pbf'>ZGFL</td><td id='zzdmk_671_zwm'>基层管理</td><td id='zzdmk_671_sortid'>44444</td><td><input style='width:70%;height:70%;' type='radio' name='radio_iframe' onclick="select_iframe('zzfl_id', 'zgfl,sortid', 'zzdmk_671', 'zwm,sortid', '1')"></td></tr>
<tr ondblclick="select_iframe('zzfl_id', 'zgfl,sortid', 'zzdmk_672', 'zwm,sortid', '2')" ><td>5</td><td id='zzdmk_672_pbf'>ZGFL</td><td id='zzdmk_672_zwm'>专业技术类</td><td id='zzdmk_672_sortid'>55555</td><td><input style='width:70%;height:70%;' type='radio' name='radio_iframe' onclick="select_iframe('zzfl_id', 'zgfl,sortid', 'zzdmk_672', 'zwm,sortid', '1')"></td></tr>
</table>


<script> parent.document.getElementById('popup').style.display = 'block'; </script>

iframe弹窗--主页面


       
















https://www.yzktw.com.cn/post/1554566.html

https://blog.51cto.com/u_16070335/6189297

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<style type='text/css'>
.popup {
	display: none;
	position: fixed;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: 70%;
	height: 60%;
	background-color: #E8E8E8;
	padding: 20px;
	border-radius: 10px;
	box-shadow: 0px 0px 20px rgba(0,0,0,0.5);
}

.popup .close-btn {
	position: absolute;
	top: 10px;
	right: 20px;
	font-size: 20px;
	color: black;
	cursor: pointer;
}
</style>

<div class="popup" id="popup" style='z-index:99;display:none;'>
<span class="close-btn">X</span>
<iframe id='n_iframe' src='' style='width:96%;height:100%; border: 1px solid #E8E8E8;'>
</iframe>
</div>

<script>
var closeBtn = document.querySelector(".close-btn");
closeBtn.addEventListener("click", function() {
	popup.style.display = "none";
	document.getElementById('n_iframe').src = '';
});

var popup = document.getElementById("popup");
function popup_it(url)
{
	window.frames[0].location.href = url;
	//popup.style.display = "block"; // 在子页面显示更好
}
</script>

<center>
<br>
<input style='width:150px;' name='zzfl_id_zgfl' id='zzfl_id_zgfl' value='显示中文名'>   
<input style='width:100px;' name='zzfl_id_sortid' id='zzfl_id_sortid' value='排序值'>   
<button class='submit' type='button' id='popup_b' onclick="popup_it('/blog/2023/10/21/lang-web-popup-2/')">弹窗选择</button>

</center>