简体   繁体   中英

how to keep the url from displaying when using a href=javascript:blah()

Don't know if this is easy or not (as I'm not well versed in javascript and/or html), but I'm trying to keep the url (in this case it's a function) from showing whenever there's a mouseover. I've done it in HTML, but haven't using javascript.. my simple code is below...

<a href="javascript:CloseAndOpen(1);">Click Here</a>

I don't want the a href to appear.

Any help would be greatly appreciated!

根本不要在“href”值中使用JavaScript。

<a href=# onclick='CloseAndOpen(1)'>Click Here</a>

A link is supposed to show where it goes. If you don't want to show the address, don't use a link, just a regular element with a click event:

<span onclick="CloseAndOpen(1);">Click here</span>

You can use CSS to style it so that it looks like a link if you like.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM