document.write('<div class="css" style="font-family: monospace;"><span style="color: #808080; font-style: italic;">/*choose an element based on <br />');
document.write('whether it has an attribute.<br />');
document.write('in this case, we\'ll choose any<br />');
document.write('images with title attributes*/</span><br />');
document.write('img<span style="color: #66cc66;">&#91;</span>title<span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">&#123;</span><br />');
document.write('&nbsp; <span style="color: #000000; font-weight: bold;">border</span>: 5px <span style="color: #993333;">solid</span> <span style="color: #993333;">red</span>;<br />');
document.write('<span style="color: #66cc66;">&#125;</span><br />');
document.write('<br />');
document.write('<span style="color: #808080; font-style: italic;">/*choose an element based on<br />');
document.write('the value of the attribute.<br />');
document.write('Let\'s go for all submit buttons<br />');
document.write('on forms*/</span><br />');
document.write('input<span style="color: #66cc66;">&#91;</span>type=<span style="color: #ff0000;">&quot;submit&quot;</span><span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">&#123;</span><br />');
document.write('&nbsp; <span style="color: #000000; font-weight: bold;">color</span>: <span style="color: #993333;">white</span>;<br />');
document.write('&nbsp; <span style="color: #000000; font-weight: bold;">background</span>: <span style="color: #000000; font-weight: bold;">blue</span>;<br />');
document.write('<span style="color: #66cc66;">&#125;</span><br />');
document.write('<br />');
document.write('<span style="color: #808080; font-style: italic;">/*choose an element based on<br />');
document.write('what the attribute value starts<br />');
document.write('with. In this example, grab<br />');
document.write('any links that start with &quot;http://&quot; <br />');
document.write('(usually links external to a site)*/</span><br />');
document.write('a<span style="color: #66cc66;">&#91;</span>href|=<span style="color: #ff0000;">&quot;http://&quot;</span><span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">&#123;</span><br />');
document.write('&nbsp; <span style="color: #000000; font-weight: bold;">color</span>: <span style="color: #993333;">red</span>;<br />');
document.write('&nbsp; <span style="color: #000000; font-weight: bold;">font-weight</span>: <span style="color: #993333;">bold</span>;<br />');
document.write('<span style="color: #66cc66;">&#125;</span><br />');
document.write('<br />');
document.write('<span style="color: #808080; font-style: italic;">/*choose an element based on a <br />');
document.write('substring of the attrbute\'s value.<br />');
document.write('In this one, let\'s go for links with<br />');
document.write('the substring &quot;.com&quot; in them*/</span><br />');
document.write('a<span style="color: #66cc66;">&#91;</span>href~=<span style="color: #ff0000;">&quot;.com&quot;</span><span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">&#123;</span><br />');
document.write('&nbsp; <span style="color: #000000; font-weight: bold;">color</span>: <span style="color: #993333;">green</span>;<br />');
document.write('<span style="color: #66cc66;">&#125;</span></div>');
document.write('<br />&nbsp;<br /><div style="font-size: 12px">Brought to you by the community at <a href="http://www.bytemycode.com/snippets/snippet/59/1/" target="_blank">byteMyCode</a>.</div>');
