on Windows10, using pure Javascript only (no JQuery), how do I sort my output list of processes in alphabetical order when button is clicked? Thank you.
<script language="JavaScript">
function GetProcListAndDisplayInHTML() {
var procs = GetObject("WinMgmts:").InstancesOf("Win32_Process where Name!='svchost.exe'");
var tableRowsHTML = "";
procEnum = new Enumerator(procs);
for (; !procEnum.atEnd(); procEnum.moveNext()){
var proc = procEnum.item();
tableRowsHTML += proc.Name + ' : ' + proc.ProcessID + '<br>';
}
return tableRowsHTML;
}
function GetSysRunProc() {
ProcessTable.innerHTML = GetProcListAndDisplayInHTML();
}
function Sort() {
}
</script>
<body>
<input type="button" value="Show Processes" onclick="GetSysRunProc();">
<input type="button" value="Sort" onclick="Sort();">
<div id="ProcessTable"></div>
</body>
New contributor
Junk is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.