Skip to content

Instantly share code, notes, and snippets.

@djshaji
Created March 29, 2023 07:30
Show Gist options
  • Save djshaji/385e7b0c7f24d6f9cf2b228cf43b3b5b to your computer and use it in GitHub Desktop.
Save djshaji/385e7b0c7f24d6f9cf2b228cf43b3b5b to your computer and use it in GitHub Desktop.
list = {}
for (table of document.getElementsByTagName ("table")) {
name = null
reg = null
rollno = null
subjects = null
for (tr of table.getElementsByTagName ("tr")) {
for (td of tr.getElementsByTagName ("td")) {
if (td.width == "44%") reg = td.innerText
if (td.width == "20%") rollno = td.innerText
if (subjects == null){
if (td.style.fontSize == "12px" && td.style.fontWeight == "bold" ) {
if (td.innerText .startsWith ("Subjects")) {
subjects = td.innerText
console.log (subjects)
list [reg] = {
rollno: rollno,
subjects: subjects
}
continue
}
}
}
}
}
}
list
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment