First of all I'm a newbie in JavaScript so be patient.
Here is what I want to do. There are several unique links that are returned from a search. I want to be able to use JavaScript's querySelectorAll() to grab the collection of these links and be able to click on any one in the collection.
I've started with the following and it works great if I just want one link in my_results but I want all of the links on the page that represents the following format regardles of the "4N2mka256C4" digits.
var my_results = document.querySelectorAll('a[href="/iac/viewAlert.do?alertId=4N2mka256C4="]');
Again, I believe the problem is with these unique "4N2mka256C4" digits. However I do not know for sure. I thought about using reg expressions to get all the links regardless of those 11 digits, but I'm a newbie with reg expressions also.
The following is the solution. It grabs the first column of the returned search results and the code identifies the links within the cells and places them (links) into the collection my_links. Then it chooses a number from my_links.length and randomizes it for a selection to be used later on.
var my_links = document.querySelectorAll("#TableResult>tbody>tr>td:nth-of-type(1)>a");
Bookmarks