Ok, thank you for ideas.
 
But the procedure:
 
1.loading+tokenize all elements of a HTML into mutiple (many) vars (array 
of string vars), then 
2.iterating over all these vars to find out the <td> with width="320px" then
3.replacing the attribute value as you suggested
 
...seems to be very longwinded and unconvenient.
 
Isn't there a short path replacement for that? Something like this
 
loadcurrentHTML().replaceALLstrings('width="320px"','width="500px"').savecurrentHTML();
 
It would be acceptable for me to replace accidentially in rare occasions a 
width="320px" attribute in
lets say a <table> rather than in a primarily targeted <td> tag.
 
Ben
 

On Thursday, February 14, 2013 8:43:41 PM UTC+1, LWChris wrote:

> Am 14.02.2013 11:20, schrieb Ben: 
> > Sorry, I meant: 
> >   
> > if "width=320px in <td> tag" then 
> >     set width=500px; 
>
> Assuming your td element is saved in the a variable called "elem", you 
> can use this (not very clean but it works): 
>
> var elemStyle = elem.getAttribute("style", 
> false).replace(/\bwidth\s*:\s*320px\b/i,"width: 500px"); 
> elem.setAttribute("style", elemStyle); 
>
> However I'd also recommend to learn the JavaScript and DOM basics before 
> you start to write scripts. 
> Not only that your code will be much cleaner than the one above, but 
> also you'll not need to ask a 
> Greasemonkey user mailing list for general JavaScript questions ;) 
>
> Chris 
>

-- 
You received this message because you are subscribed to the Google Groups 
"greasemonkey-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/greasemonkey-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to