回发后仍保持访问的超链接颜色 [英] persist visited hyperlink color after postback

查看:68
本文介绍了回发后仍保持访问的超链接颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好朋友,

我在网页中使用了一些超链接.

此超链接是动态生成的超链接.我给a.visited颜色设置为红色,但是当我单击超链接时,它将回发页面,而当页面回发时,它将超链接状态更改为未访问.

有什么办法可以保持超链接的访问状态???

有人可以建议我吗?

提前谢谢.
Shailesh J.
:-)

Hello friends,

I am using some hyperlinks in my web page.

This hyperlinks are dynamically generated hyperlinks. I have given a.visited color to be red but when i click on hyperlink it postback the page and when page postbacks it changes the hyperlinks state to unvisited.

Is there any way to persist the visited state of hyperlink???.

Can anybody suggest me for same.

Thanks in advance.
Shailesh J.
:-)

推荐答案

最简单的方法是使用相同的URL.如果您正在动态生成它们以包含某种形式的验证码,请将其放入会话或cookie中,而不是链接的URL中.浏览器将自动以访问的颜色显示指向其历史记录(或高速缓存,我不确定它如何工作)的URL的链接.
The simplest way is to use the same URL. If you''re dynamically generating them to include some sort of verification code, put that in the session or in a cookie instead of in the linked URL. The browser will automatically show links to URLs that are in its history (or cache, I''m not 100% sure on how that works) in the visited colour.


动态地,您可以添加基于状态的超链接的CSS类
您需要将其保留在ViewState或Session中
Dynamically u can add CSS class to the hyper link based on the status
which u need to keep in ViewState or Session


您好,


请参阅以下在CSS中创建的类.您可以根据需要进行编辑.

.arial12grey
{

border:0px;
border-style:none;
font-family:arial;
/*字体大小:8pt;颜色:#8c8c8c; */
font-weight:normal;


}

a.arial12grey
{
border:0px;
border-style:none;
font-family:arial;
字体大小:8pt;
font-weight:normal;
颜色:#8c8c8c;
text-align:center;
文字修饰:无;

}
a.arial12grey:hover
{border:0px;
font-family:arial;
字体大小:8pt;
font-weight:normal;
颜色:#000000;
文字修饰:无;
/*行高:正常; */
}

在生成超链接时,会动态将此CssClass附加到那些超链接.
Hello,


Refer following class created in css. You can edit those as per your need.

.arial12grey
{

border:0px;
border-style:none;
font-family:arial;
/*font-size: 8pt;color: #8c8c8c;*/
font-weight: normal;


}

a.arial12grey
{
border:0px;
border-style:none;
font-family:arial;
font-size: 8pt;
font-weight: normal;
color: #8c8c8c;
text-align:center;
text-decoration:none;

}
a.arial12grey:hover
{border:0px;
font-family:arial;
font-size: 8pt;
font-weight: normal;
color: #000000;
text-decoration: none;
/*line-height: normal;*/
}

While generating the hyperlink dynamically attache this CssClass to those hyperlink.


这篇关于回发后仍保持访问的超链接颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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