Javascript Html Table Parsing
HTML &l
Solution 1:
Try this (jsfiddle), increment the cell index by 2 each time, and use the simpler td
selector:
function method () {
var year = document.getElementById("year").value;
var month = document.getElementById("month").value;
var data = new Date(year, month - 1, 1);
var dataTable = document.getElementById("table");
var cells = dataTable.querySelectorAll("td");
for (var i = 0; i < cells.length; i+=2) {
var mikro = cells[i].firstChild.data.split("-");
var place = cells[i+1].firstChild.data;
console.log(mikro, place);
var yearMonth1 = mikro[0].split(".");
var yearMonth2 = mikro[1].split(".");
var data1 = new Date(yearMonth1[0], yearMonth1[1] - 1, 1);
var data2 = new Date(yearMonth2[0], yearMonth2[1] - 1, 1);
if (data1 <= data && data2 >= data) {
alert(place);
}
}
}
1999.09-2007.06 | Secondary School | |
2007.09-2011.06 | Has A Class, Add Class To Table Cell |
Let's say I have the following html: …
WebRTC Video Constraints Not Working
I'm trying to get a lower resolution from the webcam na…
HasClass Doesn't Work In My Js Code?
I want to use hasClass in the following code, but that does…
I am relatively new to Javascript/Ajax. When the user click…
Highcharts Donutchart: Avoid Showing Duplicate Legend With Nested Charts
I am trying to represent nested data using Highcharts Donut…
How Do I Use Data From Vue.js Child Component Within Parent Component?
I have a form component where I use a child component. I wa…
Logic For The Next Button For The Questionnaire?
I am beginner in AngularJS and facing some issues. I am try…
Assignment To Property Of Function Parameter (no-param-reassign)
I have this function and while I have this working nicely, …
I am making a web application using nodejs and angular cli …
How To Show Website Preloader Only Once
I added a preloader to my website and the preloader animati…
|
---|
Post a Comment for "Javascript Html Table Parsing"