Am 03.04.2012 09:29, schrieb Ben Stover:
Interesting. However my initial post contained only a simplified version of the
scenario.
The more detailed version looks like this:
<div class="myclass which contains blanks">
<a name="navi" title="" href="http://www.someurl.com/">
<img title="mylogo" alt=... src=...>
</a>
</div>
So if I code now:
$("div.myclass which contains blanks img").setAttribute('width', '200px');
$("div.myclass which contains blanks img").setAttribute('height', '40px');
it does not work.
First problem: The class name which contains blanks. How do specify it in the
command you suggested?
Second problem: Is it necessary to insert the "a" tag somehwere to keep the
hierarchy information?
Thank you
Ben
First problem: "Myclass which contains blanks" should be named "myclass
that cannot be named like this because blanks are not allowed" ;)
If you're looking at a website's source and find an element like this
<div class="navigation fullwidth dark shaded">
that means that the div-element has the four classes "navigation",
"fullwidth", "dark" and "shaded" applied.
Btw, if you want to have a class name with more than one word, use
"CamelCasing" or hyphens or underscores to separate words if you need
to: "myClassWithoutBlanks". However I'd recommend to use shorter (but
telling) names.
<div class="linkedImg resizeImg">
<a name="navi" title="" href="http://www.someurl.com/">
<img title="mylogo" alt=... src=...>
</a>
</div>
$("div.resizeImg img").attr("width", "200px");
Just for your benefit: the correct notation to select nodes that have
both the class "resizeImg" AND "linkedImg" is "div.linkedImg.resizeImg"
(or "div.resizeImg.linkedImg", the order doesn't matter).
Second problem: No, the blank between two statements in a selector-rule
means "all levels of the childnode tree".
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.