Changing colspan="16" value to "17"
|
|
Any suggestions on how to change this: colspan="16" to this? colspan="17" I tried using xpath and innerHTML but the table isn't turning out correctly. |
|
|
Well, you'll have to give us more details. On what page? How does your code look like right now? It should be as easy as |
|
|
Thanks for your help. I found another way to do it based on your reply. On this page (http://fantasygames.sportingnews.com/baseball/s...) I'm trying to add another column. This code seems to be working: var blahs = document.getElementsByTagName('TD');
|
|
|
Here's a shortcut using Xpath...
var blahs = document.evaluate("//td[@colspan='16']", document, null,
XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
for (var i = 0; i < blahs.snapshotLength; i++) {
var blah = blahs.snapshotItem(i);
blah.setAttribute('colspan', '17');
}
The thing is I don't know if attribute case is an issue, they should really all be lower case but often they're mixed up and ones like COLSPAN are often upper case. In Xpath I think @attribute is not case sensitive but the value is, which isn't an issue here since it's a number. If for some reason setAttribute don't work try
|
