如何转储HREF并仍然将光标转向一只手? [英] How can I dump the HREF and still have the cursor turn to a hand?

查看:80
本文介绍了如何转储HREF并仍然将光标转向一只手?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一个相当长的页面上使用了一些JS,并且不喜欢

的方式


< A HREF = '''''ONCLICK = \" ...


将页面刷新到顶部。删除HREF(< A ONCLICK = \" ...)

解决了我的问题但是当滚动链接时,光标不再变为

小手。我可以同时拥有吗?没有HREF和

小手?


提前感谢您推动正确的方向! :)

I used a bit of JS on a page that is fairly long and didn''t like the
way that

<A HREF=''#'' ONCLICK=\"...

refreshed the page to the top. Removing the HREF (<A ONCLICK=\"...)
solved my "problem" however the cursor no longer changes into the
little hand when rolling over the link. Can I have both? No HREF and
the little hand?

Thanks in advance for a push in the right direction! :)

推荐答案




Bill H写道:


Bill H wrote:
我在一个相当长的页面上使用了一些JS,并且不喜欢

< A HREF =''#''ONCLICK = \ ; ...

将页面刷新到顶部。


您可以使用

< a href ="#"的onclick = QUOT; ...;返回false;">

以防止这种情况。

删除HREF(< A ONCLICK = \" ...)
解决了我的问题"问题"但是当滚动链接时,光标不再变为
小手。我可以同时拥有吗?没有HREF和
小手?
I used a bit of JS on a page that is fairly long and didn''t like the
way that

<A HREF=''#'' ONCLICK=\"...

refreshed the page to the top.
You could use
<a href="#" onclick="...; return false;">
to prevent that.
Removing the HREF (<A ONCLICK=\"...)
solved my "problem" however the cursor no longer changes into the
little hand when rolling over the link. Can I have both? No HREF and
the little hand?




使用CSS

< style type =" text / css">

a.whatever {

光标:指针;

}

< / style>


< a class =" whatever">

应该用Netscape 7,IE 6,Opera 7,Mozilla


-


Martin Honnen
http ://JavaScript.FAQTs.com/



Use CSS
<style type="text/css">
a.whatever {
cursor: pointer;
}
</style>

<a class="whatever">
Should do with Netscape 7, IE 6, Opera 7, Mozilla

--

Martin Honnen
http://JavaScript.FAQTs.com/


" Bill H" < maylar69 @热---- COM>在消息中写道

news:91 ******************************** @ 4ax.com ...
"Bill H" <maylar69@hot----.com> wrote in message
news:91********************************@4ax.com...
我在一个相当长的页面上使用了一些JS,并且不喜欢

< A HREF = '''''ONCLICK = \" ...

将页面刷新到顶部。删除HREF(< A ONCLICK = \" ...)
解决了我的问题。但是当滚动链接时,光标不再变为
小手。我可以同时拥有吗?没有HREF和
小手?
I used a bit of JS on a page that is fairly long and didn''t like the
way that

<A HREF=''#'' ONCLICK=\"...

refreshed the page to the top. Removing the HREF (<A ONCLICK=\"...)
solved my "problem" however the cursor no longer changes into the
little hand when rolling over the link. Can I have both? No HREF and
the little hand?




这可以用CSS而不是Javascript来完成。添加cursor:hand;

你的风格标签,例如:

< a style =" cursor:hand;" onclick =" doStuff();">以前的链接< / a>


光标的其他一些有用的值包括:

arrow:the标准指针

十字准线:十字光标

help:?光标

move:移动窗口光标

文本:文本选择光标

等待:沙漏光标


此外,您可以重新创建调整大小游标(例如,当从角落调整

a窗口时显示的那些)以下内容:

n-resize,s-resize:上/下箭头

e-resize,w-resize:左/右箭头

ne-resize,sw-resize:左下角/右上箭头

nw-resize, se-resize:左上/右下箭头


希望有所帮助。


-


Blue Raja

此外,真正的邪恶从未通过试图使自己合法化而显示出来。

以''Raja为例。他是一个邪恶的小混蛋,并没有必要向世界宣布它。他通过礼貌的方式对数百万人进行了贬值,并在他的道路上留下了毁灭性的祸患。 - Butch

RGMW常见问题 - 按Yoda Bob的命令
http: //www.rgmw.org


比尔H说:

我用了一点JS页面相当长,不喜欢

< A HREF =''#''ONCLICK = \" ...
<刷新页面到顶部。

I used a bit of JS on a page that is fairly long and didn''t like the
way that

<A HREF=''#'' ONCLICK=\"...

refreshed the page to the top.




如果你不想要一个链接,请让你的onclick处理程序

返回false。空锚#是指向

当前页面顶部的链接。


< a href ="#" ; onclick =" ...; return false"


会做你想要的。


在现代浏览器中,你可以使用CSS来设置任何

范围文本的光标,也可以为这样的

文本分配一个onclick处理程序,但使用上面的链接更简单。



If you don''t want a link to be followed, have your onclick handler
return false. The null anchor, "#", is a link to the top of the
current page.

<a href="#" onclick="...;return false"

will do what you want.

In modern browsers, you can use CSS to set the cursor for any
span of text, and can also assign an onclick handler for such
text, but using the link as above is simpler.


这篇关于如何转储HREF并仍然将光标转向一只手?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆