发生变化时如何将访问的链接更改为未访问的链接 [英] How to change visited links into unvisited links when something changed

查看:82
本文介绍了发生变化时如何将访问的链接更改为未访问的链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么方法可以使访问过的链接恢复为未访问状态,而又不会从hystory中删除任何内容?我想在论坛上这样做,当有人回复某个主题时,它必须将该主题链接变成未访问的主题.

Is there any way to make a visited link back to unvisited without deleteing anything from hystory? I want to do that on a forum, when someone replies in a topic, it has to turn that topic link into unvisited.

我正在使用此CSS:

a.newold:visited
{color:#999999;}
a.newold:link
{font-weight: bold;}

,并且有主题列表:

<a class="newold" href="read_topic.php?id=ID">TITLE</a>

问题是:当我单击某个主题时,它会在访问时自动更新吗?

The thing is: When I click on a topic, it will be automatically updated as visited?

我想要(如果可能的话)当我在该主题中添加回复时,其链接将更新为访问过

I want something, (if is possible) that when I add a reply INSIDE that topic, its link will be updated as unvisited

有关我要寻找的内容的更多信息:

More information about what I am seeking:

示例:主题名称将为:TEST. 首先不访问该主题,它看起来像: 测试

Example: The topic name will be: TEST. The topic first is unvisited, and it looks like: TEST;

点击它,我阅读它,它看起来像: 测试;

I click on it, I read it, it will look like: TEST;

然后我在该主题中添加回复;

Then I add a reply in that topic;

该主题将再次出现 un : TEST ;

The topic will look unvisited again: TEST;

我认为这很清楚.

如果我使用$user所示的其他变量,例如topic_id,那会很不好,因为它是一个大请求,所以我想知道是否有一些事情可以在没有数据库请求的情况下完成.

If I use some other variable like $user seen topic_id, it will be bad, because it is a large request, so I wonder if there is something that can be done without database requests.

推荐答案

您可以控制与:visited伪类链接的访问者的样式.您可以为访问的链接定义必要的颜色设置,当需要将链接标记为已回复时,可以向其中添加一些CSS类,并定义如下CSS规则:

You can control styles of visited linked with :visited pseudo-class. You can defined necessary color settings for visited links and when you need to mark link as replied you can add some CSS class to it, and defined CSS rules like this:

a.updated:visited {
    color: #00E;
}

这是一个小演示:

a.updated:visited {
    color: #00E;
}

<a href="http://stackoverflow.com">Visited without class</a>
<a class="updated" href="http://stackoverflow.com">Visited with class</a>

这篇关于发生变化时如何将访问的链接更改为未访问的链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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