Re: [greasemonkey-users] How to change width="...." value for all tags in ONE statement?

Fri, 30 Mar 2012 07:46:44 -0700

On Fri, Mar 30, 2012 at 10:35 AM, Ben Stover <[email protected]> wrote:

> Is there a way to do this for all DIV tags or TABLE tags in ONE statement?


No.  It can be done in relatively few statements, however.  E.g.

var tableEls = document.getElementsByTagName('table');
for (var i = 0, tableEl = null; tableEl = tableEls[i]; i++) {
  // Pick one of these two statements:
  tableEl.removeAttribute('width');
  tableEl.setAttribute('width', '98%');
}

This is general purpose DOM manipulation code and has nothing particular to
do with Greasemonkey.

-- 
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.

Reply via email to