Links

Lists

Latest Updates

Ruby On Rails List
Python list
Advanced Java
The JavaScript List
Apache Users
Full Disclosure
Linux Security

Search the archives!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Javascript] Accessing a nested Anchor element.


  • From: ian.skinner at bloodsource.org (Ian Skinner)
  • Subject: [Javascript] Accessing a nested Anchor element.
  • Date: Mon Apr 18 14:05:10 2005

Thanks, but the issue was that I was blinking the style.  Changing it back and forth a dozen times as an indicator of the results of a search, showing the user where in the page, the item (G23520050328 for example) is located.  It is a calendar of events, with lots and lots of events in a month.


--------------
Ian Skinner
Web Programmer
BloodSource
www.BloodSource.org
Sacramento, CA
 
"C code. C code run. Run code run. Please!"
- Cynthia Dunning

...-----Original Message-----
...From: Paul Novitski [mailto:paul@xxxxxxxxxxxxxxxxxxxx]
...Sent: Monday, April 18, 2005 11:15 AM
...To: [JavaScript List]
...Subject: Re: [Javascript] Accessing a nested Anchor element.
...
...At 09:49 AM 4/18/2005, Ian Skinner wrote:
...>Assume the following HTML markup.
...>
...><td id="G23520050328_name">
...>         <a href="..." title="..." onClick="...">CalHFA</a>
...></td>
...>
...>In a JS function there is basically this assignment. [This of course is
...>done dynamically but I am simplifying for this question.]
...>
...>var name_cell = document.getElementById("G23520050328_name");
...>
...>What I would like to know, what is the simplest yet cross browser
...>compatible method to access the <a>nchor element in the "name_cell"
...>reference in order to set a style property on the anchor?  The color
...>property in my current requirement.  This can hopefully be done with
...>little to no extra HTML since there are hundreds of these cells.
...
...
...Ian,
...
...As an alternative to assigning inline styles with javascript, you could
...also approach the problem with CSS.  Here are two methods:
...
...         <td id="G23520050328_name">
...                 <a href="..." title="..." onClick="...">CalHFA</a>
...         </td>
...
...         td#G23520050328_name a,
...         td#G23520070239_name a,
...         td#G23520090140_name a
...         /* etc. */
...         {
...                 property: value;
...         }
...
...Or, better:
...
...         <td id="G23520050328_name" class="x">
...                 <a href="..." title="..." onClick="...">CalHFA</a>
...         </td>
...
...         td.x a
...         {
...                 property: value;
...         }
...
...If you style your links this way, is the unique id on each cell necessary
...to support some other functionality or can you eliminate it entirely to
...shrink your markup?
...
...Paul
...
...
..._______________________________________________
...Javascript mailing list
...Javascript@xxxxxxxxxx
...https://lists.LaTech.edu/mailman/listinfo/javascript

Confidentiality Notice:  This message including any
attachments is for the sole use of the intended
recipient(s) and may contain confidential and privileged
information. Any unauthorized review, use, disclosure or
distribution is prohibited. If you are not the
intended recipient, please contact the sender and
delete any copies of this message.