V
Vincent van Beveren
Hey everyone,
I've looked for this and I wouldn't know what the best practice would be
for solving the following problem.
We use a BASE tag in our HTML pages. Now we have some links that use the
<A HREF="#" onclick="...">Hello</A> method to invoke a JavaScript.
However, because of the BASE tag, when clicking a link containing only a
# as 'href' it will load the root index.html file. What I want is it to
do nothing and execute the onclick handler.
Now I have two possible solutions:
- Replace the # with Javascript:... and remove the onclick handler.
- Replace the A HREF by a SPAN having the same style as a link.
Both however, I've learn it isn't good practice to use javascript: in a
link. The SPAN as link would be a sort of Sim-HREF, which will probably
end up being trouble (span:hover anyone?). Anyone has a viable solution,
cause I must be missing something.
Thanks in advance,
Vincent
I've looked for this and I wouldn't know what the best practice would be
for solving the following problem.
We use a BASE tag in our HTML pages. Now we have some links that use the
<A HREF="#" onclick="...">Hello</A> method to invoke a JavaScript.
However, because of the BASE tag, when clicking a link containing only a
# as 'href' it will load the root index.html file. What I want is it to
do nothing and execute the onclick handler.
Now I have two possible solutions:
- Replace the # with Javascript:... and remove the onclick handler.
- Replace the A HREF by a SPAN having the same style as a link.
Both however, I've learn it isn't good practice to use javascript: in a
link. The SPAN as link would be a sort of Sim-HREF, which will probably
end up being trouble (span:hover anyone?). Anyone has a viable solution,
cause I must be missing something.
Thanks in advance,
Vincent