在IE中悬停模拟 [英] Hover emulating in IE

查看:75
本文介绍了在IE中悬停模拟的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好。


如何在IE中简单模拟这个类?


..示例:悬停{

border:1px solid#696969;

}


Greets,

Cezar。

解决方案

Cezar写道:

如何在IE这个类中简单模拟?


对不起,我不太清楚你在问什么。你能用更清晰的词语试试改写

吗?

。例如:悬停{
border:1px solid#696969;
}




这看起来是正确的;你遇到的问题是什么?您是否尝试使用< a>以外的其他内容创建悬停样式

元素?


顺便说一下,最好不要*添加*边框:悬停。考虑

仅更改边框颜色:悬停。


-

Brian(删除.invalid以发送电子邮件me)
http://www.tsmchughs.com/


2004年6月15日星期二02:28:43 +0200,Cezar< ce ***** @ imail.net.pl>写道:

你好。

如何在IE这个类中简单模拟?

。例如:悬停{
边框:1px固体#696969;
}

Cezar。




如果我是对的,你想得到:悬停在IE上工作的元素除了

< a>。你需要使用像Javascript这样的东西。


Neal< ne ***** @ yahoo.com>写道:

如果我是对的,你想得到:悬停在IE上工作的其他元素比< a>。你需要使用像Javascript这样的东西。




是的,在Javascript中操纵元素的样式,例如

< style type =" text / css">

..example {border:solid 1px white; }

< / style>

< script type =" text / javascript">

函数setborder(elem,color) {

elem.style.borderColor = color; }

< / script>

....

< p class =" example"

onmouseover =" setborder(this,''#696969'')"

onmouseout =" setborder(this,''white'')">

这是一个例子。< / p>


(当然,你在javascript中得到更好的建议

news:comp.lang.javascript及其常见问题。)


尽管不是很明智,但是可以玩一些丑陋的技巧来实现例如段落的整个文本< a>元素(自然地假设它

不包含任何真正的< a>元素)并尽力使它成为

_not_表现为链接除了目的:悬停造型。例如,


< style type =" text / css">

..example a {display:block;

背景:白色;

颜色:黑色;

text-decoration:none;

cursor:default;

border:solid 1px white; }

..示例a:悬停{border-color:#696969; }

< / style>

< script type =" text / javascript">

函数setborder(elem,color) {

elem.style.borderColor = color; }

< / script>

....


< p class =" example">< ;名称=" a42" HREF ="#A42" tabindex =" 0">

这是一个例子。< / a>< / p>


然而它仍然表现为链接在很多方面,扰乱了

用户。您可以使用onfocus =" ..."删除部分问题。和

onclick =" ..."试图阻止元素获得焦点并禁用任何点击效果的属性,但是你正在使用比你需要更多的Javascript来获得
相对简单的想法

模拟:用Javascript悬停。


-

Yucca, http://www.cs.tut.fi/~jkorpela/


Hello.

How can simple emulating in IE this class ?

..example:hover{
border: 1px solid #696969;
}

Greets,
Cezar.

解决方案

Cezar wrote:

How can simple emulating in IE this class ?
Sorry, I cannot quite grasp what you''re asking. Can you try rephrasing
it in clearer words?
.example:hover{
border: 1px solid #696969;
}



This looks correct; what is the problem you are having? Are you trying
to create hover styles on something other than an <a> element?

By the way, it''s best not to *add* a border on :hover. Consider
changing only the border color on :hover.

--
Brian (remove ".invalid" to email me)
http://www.tsmchughs.com/


On Tue, 15 Jun 2004 02:28:43 +0200, Cezar <ce*****@imail.net.pl> wrote:

Hello.

How can simple emulating in IE this class ?

.example:hover{
border: 1px solid #696969;
}

Greets,
Cezar.



If I''m right, you want to get :hover to work in IE on elements other than
<a>. You''ll need to use something like Javascript to do this.


Neal <ne*****@yahoo.com> wrote:

If I''m right, you want to get :hover to work in IE on elements other
than <a>. You''ll need to use something like Javascript to do this.



Yes, manipulating the element''s style in Javascript, e.g.

<style type="text/css">
..example { border: solid 1px white; }
</style>
<script type="text/javascript">
function setborder(elem,color) {
elem.style.borderColor = color; }
</script>
....
<p class="example"
onmouseover="setborder(this,''#696969'')"
onmouseout ="setborder(this,''white'')">
This is an example.</p>

(Naturally you get better advice on Javascript in
news:comp.lang.javascript and its FAQ.)

It would be possible, though hardly wise, to play some ugly tricks to
make e.g. a paragraph''s entire text an <a> element (naturally assuming it
does not contain any real <a> elements) and to do your best to make it
_not_ behave as a link except for the purpose of :hover styling. E.g.,

<style type="text/css">
..example a { display: block;
background: white;
color: black;
text-decoration: none;
cursor: default;
border: solid 1px white; }
..example a:hover { border-color: #696969; }
</style>
<script type="text/javascript">
function setborder(elem,color) {
elem.style.borderColor = color; }
</script>
....

<p class="example"><a name="a42" href="#a42" tabindex="0">
This is an example.</a></p>

However it would still behave as a link in many ways, disturbing the
user. You could remove part of the problem by using an onfocus="..." and
onclick="..." attribute that try to prevent the element from getting
focus and to disable any clicking effects, but then you''re on your way to
using more Javascript than you need for the relatively simple idea of
simulating :hover with Javascript.

--
Yucca, http://www.cs.tut.fi/~jkorpela/


这篇关于在IE中悬停模拟的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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