Hi @ll,I'm trying to change all comma's in a table with point so I can load the table in excel without any problems.I want to create a short script to replace all comma's to points, but it isn't working.I'm pretty new to scripting and trying to help myself (especially via W3schools) so my question may be a bit "simple/stupid" At first i've tried this code:
var Table = document.getElementById('members');Table.replaceAll(",", ".");
But it doesn't work this way. Probably because the complete table is not a string? Currently I have this code:
var Table = document.getElementById('members');var rowLength = Table.rows.length;for (i = 1; i < rowLength; i++) {var Cells = Table.rows.item(i).cells;var cellLength = Cells.length;for (var j = 0; j < cellLenght; j++) { var cellVal = Cells.item(j).innerHTML; cellVal.replaceAll(",", ".");}}
Also this isn't working. I'm getting the error: Cannot convert 'Table' to object at line 2.I'm pretty sure the ID 'members' is the right ID.The table that needs to change is located here. What am I doing wrong?Should the first scipt also work?Thnx in advance!
replaceAll in table
in JavaScript
Posted · Edited by nero987
Hi @ll,I'm trying to change all comma's in a table with point so I can load the table in excel without any problems.I want to create a short script to replace all comma's to points, but it isn't working.I'm pretty new to scripting and trying to help myself (especially via W3schools) so my question may be a bit "simple/stupid" At first i've tried this code:
But it doesn't work this way. Probably because the complete table is not a string? Currently I have this code:
Also this isn't working. I'm getting the error: Cannot convert 'Table' to object at line 2.I'm pretty sure the ID 'members' is the right ID.The table that needs to change is located here. What am I doing wrong?Should the first scipt also work?Thnx in advance!