Click to See Complete Forum and Search --> : Styling "name" Attribute
Cory R
04-25-2008, 07:21 PM
Is it possible to grab a specific name attribute from an HTML element to style it with CSS? Either with CSS or JavaScript; either will do.
<a name="label">Text to be displayed</a>
smyhre
04-25-2008, 10:00 PM
Use id instead of name.
just one example:
html:
<p id="name">This is a paragraph</p>
css:
p#name {color: blue;}
Cory R
04-25-2008, 10:08 PM
I'm using a self-hosted message board that has a default source that can't be edited, unfortunately. That is why I need to style the name attribute specifically.
smyhre
04-25-2008, 10:17 PM
Ugggh! Is that <a> contained in anything like a div or something that actually has a id or class attributed to it?
Cory R
04-25-2008, 10:38 PM
It's located within a table cell, like so:
<td class='row1'>
<input type='hidden' name='regid' value='390ad7ee86e57512441fa495d0efd2c7' />
CONTENT
</td>
smyhre
04-25-2008, 10:58 PM
ok then use something like:td.row1 input a {color: blue; line-height: 1.5em;}
The bolded part of course can be anything you want i just put in some random values.
smyhre
04-25-2008, 11:05 PM
Now that I look at it again you may want to use only td.row1 a {some: value;} because the input doesn't contain the <a> if im not mistaken.
Cory R
04-25-2008, 11:20 PM
td.row1 img is what I'm using, which works. However, is it possible to change the background color of an image that is already existing, in which you have no control over due to the fact that default source code is not editable. Say, for example, I wanted to change the background color of this image (http://209.85.48.8/9764/158/upload/p3524316.gif) from it's current color (#E9F0F2) to blue. Sounds to me like it would require JS.
smyhre
04-25-2008, 11:34 PM
Nope that is a photoshop job on the image which I just did on your image. Though if you cant replace the image then this wont work. But see attached file.
Cory R
04-25-2008, 11:44 PM
I was just using that image as an example. :)
Any who, I can't change the image, unfortunately, and I don't believe I could with JS either, as each image has a unique ID (used for the CAPTCHA). Here's one of the images as an example: Click Here (http://z8.invisionfree.com/testing123testing123/index.php?act=Reg&CODE=image&rc=0801cec3a9eec40eb07e0fb397ce6f37&p=1)
I'm trying to change the background color of that image, which seems to be impossible with the source code being un-editable and all.
smyhre
04-25-2008, 11:56 PM
Sigh such limitations. Well the problem comes in at the part where I have never heard of a way to change a background on an image without using an image editor like photoshop and certainly never by using javascript or such online code. You might be able to try an image replacement but I'm not sure how you would be able to do that with all your limitations.
which seems to be impossible with the source code being un-editable and all.
Un-editable? At all? In this case you can do nothing. How could you expect to modify something on a page which is not to be touched...But, well... there might be a trick: is there a javascript external code like
<script type="text/javascript" src="somejsfile.js"></script>
and can you edit that "somejsfile.js" ? If so, there is a javascript solution.
Cory R
04-26-2008, 12:06 AM
We can certainly edit default code with JS, however, the source itself cannot be touched. We have the ability to add additional JS to the board, which could effect that page directly. However, for the most part, we only have access to the HTML of the source code.
Cory R
04-27-2008, 06:19 PM
So, is the JavaScript solution doable with the access I have?