or try:
document.getElementByTagNa
Main Topics
Browse All TopicsI'm trying to add attributes to html tag <a href> so that i can dynamically changes classes and rel.
Javascript doesn't work as long as rel exists on <a href>
for instance,
<a href="#" rel="dropmenu1" class="tab_on_left" onmouseover="highlight(thi
highlight(this) function doesn't work because rel="dropmenu1" if remove rel="dropmenu1" then onmouseover() function works fine.
So i what i want to do this add the "rel" & change "class" attributes for <a href> using javascript within that
javascript function: hightlight(this).
Let me know if this is possible..
Thanks
Cindy
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
I have many html <a href> tags on page how would my javascript a tag attribute correspond to that particular one i need ..
Here goes my script and sample HTML,plz suggest me a work around for this.
<SCRIPT>
function highlight(id)
{
document.getElementByTagNa
}
}
function nohigh(id)
{
document.getElementById(id
}</SCRIPT>
Read my comments below. I "fixed" your code as best I could. Don't really understand what you are trying to do based on the code fragment you posted.
FYI: "Javascript doesn't work as long as rel exists on <a href>"
rel and javascript are completely unrelated. One will not interfere with the other. Your issue must be related to the fact that document.getElementsByTagN
The code you posted has syntax errors:
function highlight(id)
{
//Typo here. It should be document.getElementsByTagN
// you missed the s
document.getElementByTagNa
}
} //<== No matching brace
function nohigh(id)
{
//the error hers is that when you call nohigh as "nohigh(this)", id is NOT a string, it is a an object reference. The argument to document.getElementById MUST be a string. So you need to check if the argument is a string argument for you to use document.getElementById().
document.getElementById(id
}
If you call the function like this:
<a href="http://www.dynamicdr
Then your functions are as simple as this:
<SCRIPT>
function highlight(theLink){
theLink.setAttribute("rel"
}
function nohigh(theLink){
theLink.className='el1';
}
</SCRIPT>
Or do you want to highlight different links then hovered?
By the way, do you know the hover attribute of anchor links style?
http://www.w3schools.com/c
Business Accounts
Answer for Membership
by: jasonsbytesPosted on 2008-01-22 at 20:22:33ID: 20720792
document.getElementByTagNa me('a')[0] .rel="drop menu1"; me('a')[0] .class="cl assname";
document.getElementByTagNa
The numbers in [0] need to correspond to the order of the a tags from top down.