Am 29.03.2012 18:47, schrieb Ben Stover:
Assume I want to modify the HTML structure for all webpages of a certain domain.
In detail not the a CSS statement should be altered but the HTML code.
All
<table width="....." cellspacing="..." ...>
entries should be changed into
<table .... cellspacing="0" ....>
In other words the attribute "width" should be removed everywhere in a<table>
tag.
Alternatively: How can I change it to e.g.
<table width="98%" ....>
How can I do this with Greasemonkey?
Thank you
Ben
// Declare this way to provide callback functionality
rmWidthAttribute = function () {
document.removeEventListener("load", rmWidthAttribute);
var tables = document.getElementsByTagName("table");
// Use a while loop because "getElementsByTagName" is a LIVE list.
// It could change the number of items whilst the loop is running.
var i = 0;
while (i < tables.length) {
tables[i].removeAttribute("width");
// Or alternatively: tables[i].setAttribute("width", "98%");
i++;
}
}
// Call the function as soon as the document is ready with loading
document.addEventListener("load", rmWidthAttribute, true);
Hi Ben, here you are.
Chris
--
You received this message because you are subscribed to the Google Groups
"greasemonkey-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/greasemonkey-users?hl=en.