depart_onchange.vbs

来自「物业管理和办公自动化系统」· VBS 代码 · 共 53 行

VBS
53
字号
sub e_id_OnChange()
	dim iExchId, sPorts, arrayE, arrayPorts, arrayOpt, sOpt
	dim i
	sPorts = document.all.e_id.value

	if CStr(sPorts) = "0" then	'' 只有一个 “ 所有 ”
		sOpt = "<option value=""0"">-所有-</option>"
		document.all.exch_id.value = "0"
	else
		arrayE = Split(sPorts, ":")
		iExchId = arrayE(0)
		document.all.exch_id.value = iExchId
		'msgbox document.all.exch_id.value

		arrayPorts = Split(arrayE(1), "&")
		for i = LBound(arrayPorts) to UBound(arrayPorts)
			arrayOpt = Split(arrayPorts(i), "?")
			sOpt = sOpt & "<option value=""" & arrayOpt(0) & """>" & arrayOpt(1) & "</option>"
		next
	end if
	document.all.port_id.outerHTML = "<select name=""port_id"" style=""width:86px"">" & sOpt & "</select>"
	document.all.port_id.options(0).style.color = "black"
end sub


sub onload(port_id)
	''msgbox "port_id : " & port_id
	dim iExchId, sPorts, arrayE, arrayPorts, arrayOpt, sOpt, iPortId
	dim i
	sPorts = document.all.e_id.value
	''msgbox sPorts
	if CStr(sPorts) = "0" then	'' 只有一个 “ 所有 ”
		sOpt = "<option value=""0"">-所有-</option>"
		document.all.exch_id.value = "0"
	else
		arrayE = Split(sPorts, ":")
		iExchId = arrayE(0)
		document.all.exch_id.value = iExchId

		arrayPorts = Split(arrayE(1), "&")
		for i = LBound(arrayPorts) to UBound(arrayPorts)
			arrayOpt = Split(arrayPorts(i), "?")
			iPortId = arrayOpt(0)
			if LCase(CStr(iPortId)) = LCase(CStr(port_id)) then
				sOpt = sOpt & "<option value=""" & arrayOpt(0) & """ selected>" & arrayOpt(1) & "</option>"
			else
				sOpt = sOpt & "<option value=""" & arrayOpt(0) & """>" & arrayOpt(1) & "</option>"
			end if
		next
	end if
	document.all.port_id.outerHTML = "<select name=""port_id"" style=""width:86px"">" & sOpt & "</select>"
	document.all.port_id.options(0).style.color = "black"
end sub

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?