突出显示所选的超链接 [英] highlight selected hyperlink

查看:101
本文介绍了突出显示所选的超链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有很多链接,我要突出显示在asp.net中选择的链接.我想展示特定的链接是由许多链接中的不同颜色选择的.

你能给我个主意吗?

在此先感谢

I have many links among which I want to highlight the link which is selected in asp.net.I want to show that particular link is selected by diffrent color among many link.

Can you give me any idea to do this?

Thanks in advance

推荐答案

您需要使用CSS为不同状态设置超链接颜色,如下所示

You need to set Hyperlink colors for different states using CSS as follows

<style type="text/css">
a:link {
COLOR: #0000FF;
}
a:visited {
COLOR: #800080;
}
a:hover {
COLOR: #FF0000;
}
a:active {
COLOR: #00FF00;
}
</style>


在JavaScript的帮助下,请尝试以下操作:

Step1 :-在我的情况下,.aspx页中有三个HyperLink(a1,a2,a3).假设我们要通过单击按钮(onclick)来设置颜色(a1:-红色,a2:-绿色,a3:-蓝色).
With the help of JavaScript, please try this:

Step1:- In my case, there are three HyperLink(a1,a2,a3)in my .aspx page. Suppose, we want to set the color (a1:-Red, a2:- Green, a3:-Blue) on the click of the button (onclick).
<a id="a1" onclick="showred()">Red</a><br />
<a id="a2" onclick="showgreen()">Green</a><br />
<a id="a3" onclick="showblue()">Blue</a>


Step2 :-在头部,我们指定了JavaScript函数:-


Step2:- In the head part, we specify the JavaScript function:-

function showred()
{
document.getElementById('a1').style.color='Red';
}
function showgreen()
{
 document.getElementById('a2').style.color='Green';
}
function showblue()
{
 document.getElementById('a3').style.color='Blue';
}


这篇关于突出显示所选的超链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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