I have an tag on my page that looks something like this:
开发者_高级运维<a href="javascript:void();" onclick="doAFunction(1, 2);">Do something</a>
But in Chrome, the link doesn't show as a link, just text. However, it's clickable and works fine. Should I have a class for this, or is my code incorrect?
Thanks.
I see no problem which is likely to cause a display error ... "void" should have a parameter specified methinks, but that wouldn't cause a display issue.
Try right clicking on it (in chrome) and selecting Inspect Element, that'll show you the styles that are being applied to it. You can then hopefully track down whether or not your link styles are being applied, and what might be overriding it.
PS. if you can post us a link to an example, we can probably identify the cause pretty quickly. We're good like that :P
Try this:
<a href="javascript:void();" onclick="javascript:doAFunction(1, 2);">Do something</a>
Try this:
<a href="#" onclick="doAFunction(1, 2); return false;">Do something</a>
精彩评论