Guest User

Untitled

a guest
Jan 17th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. //gets table
  2. var oTable = document.getElementById('tablename');
  3.  
  4. //gets rows of table
  5. var rowLength = oTable.rows.length;
  6.  
  7. //loops through rows
  8. for (i = 0; i < rowLength; i++){
  9.  
  10. //gets cells of current row
  11. var oCells = oTable.rows.item(i).cells;
  12.  
  13. //gets amount of cells of current row
  14. var cellLength = oCells.length;
  15.  
  16. //loops through each cell in current row
  17. for(var j = 0; j < cellLength; j++){
  18.  
  19. // get your cell info here
  20.  
  21. var cellVal = oCells.item(j).innerHTML;
  22. console.log(cellVal);
  23.  
  24. var serverRelativeUrlOfMyFile = "https://Sharepointsite/Blacklist.txt";
  25. $.ajax({
  26. url: serverRelativeUrlOfMyFile,
  27. type: "GET"
  28. }).done(handler);
  29. function handler(data){
  30. //console.log(data);
  31. var lines = data.split('n');
  32. for(var line = 0; line < lines.length; line++)
  33. {
  34. if (cellVal.includes(lines[line])){
  35. oCells.item[j].style.background = "red";
  36. }
  37. }
  38. }
  39. }
  40. }
Add Comment
Please, Sign In to add comment