473,471 Members | 1,729 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

is there a way to reset link states

Is there any way to reset a link's state. In other words reset a visited
link to an unvisited link. I guess the question I'm asking would be how do
you programatically search and clear the history of a particular page?
Oct 30 '05 #1
6 3750
VK

JimO wrote:
Is there any way to reset a link's state. In other words reset a visited
link to an unvisited link. I guess the question I'm asking would be how do
you programatically search and clear the history of a particular page?


You cannot access cache within the regular security restrictions. Why
would not set link styles equal for both visited and unvisited?

Oct 30 '05 #2
I'm actually writing on-line CSS curriculum for my High School web class.
I'm doing a lesson on psuedo-classes and was looking for a way that I can
reset the links to demonstrate how the different declarations work whenever
a kid reloads the page.

"VK" <sc**********@yahoo.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...

JimO wrote:
Is there any way to reset a link's state. In other words reset a visited link to an unvisited link. I guess the question I'm asking would be how do you programatically search and clear the history of a particular page?


You cannot access cache within the regular security restrictions. Why
would not set link styles equal for both visited and unvisited?

Oct 30 '05 #3

"JimO" <jo********************@earthlink.net> wrote in message
news:82*****************@newsread1.news.pas.earthl ink.net...
I'm actually writing on-line CSS curriculum for my High School web
class.
I'm doing a lesson on psuedo-classes and was looking for a way that
I can
reset the links to demonstrate how the different declarations work
whenever
a kid reloads the page.


Jim,

You could try using different links each time the page loads. Use js
to append a random querystring to each URL (assuming the original
hrefs do not already have one....)

Untested but I think that should be enough for the browser to see them
as new links.

Tim.
Oct 30 '05 #4
VK
JimO wrote:
I'm actually writing on-line CSS curriculum for my High School web class.
I'm doing a lesson on psuedo-classes and was looking for a way that I can
reset the links to demonstrate how the different declarations work whenever
a kid reloads the page.


This task is not such trivia and depending on the level of your class
you may want to choose a set of separate pages instead.

Pseudo-classes are not directly exposed for scripting: thus you cannot
apply something like linkObject.style.aHoverColor = newColor;

The way around it is in using imported style sheets and switching them
at runtime. This approach is demonstrated below. Please not that:

1) It doesn't work for all browsers (actually tested on IE only). See
<http://alistapart.com/articles/alternate/> for other solutions. They
are all based on the same idea but using other methods.

2) You have to create two additional files defaultLinkStyles.css and
newLinkStyles.css
Their content follows the page text.
// HTML Page
<html>
<head>
<title>Dynamic Link Style</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">

<style type="text/css">
@import url('defaultLinkStyles.css');
body { background-color: #FFFFFF;}
p { font: 10pt Verdana, Geneva, sans-serif}
</style>

<script style="text/javascript">
function f1() {
try {
document.styleSheets[0].imports[0].href =
'newLinkStyles.css';
}
catch (e) {
alert(e.description);
}
}
</script>

</head>

<body bgcolor="#FFFFFF">

<p><a href="http://www.google.com">http://www.google.com</a></p>
<p><a
href="http://www.For_Sure_Not_Viewed_Yet.com">http://www.For_Sure_Not_Viewed_Yet.com</a></p>
<p><a
href="http://groups.google.com/group/comp.infosystems.www.authoring.stylesheets?lnk=li& amp;hl=en">comp.infosystems.www.authoring.styleshe ets</a></p>

<form method="post" action="">
<input type="button" name="b01" value="Switch" onclick="f1()">
</form>

</body>
</html>
// defaultLinkStyles.css
a:active { color: #FF0000; text-decoration: underline}
/* a:visited color rule has higher priority over
a:hover if viewed from your local drive.
To fix this bug (feature?) one should use
additional !important instruction: */
a:hover { color: #FF0000 !important; text-decoration: underline}
a:link { color: #0000FF; text-decoration: underline}
a:visited { color: #800080; ; text-decoration: underline}
// newLinkStyles.css
a:active { color: #000000; text-decoration: underline}
/* a:visited color rule has higher priority over
a:hover if viewed from your local drive.
To fix this bug (feature?) one should use
additional !important instruction: */
a:hover { color: #00FF00 !important; text-decoration: underline}
a:link { color: #FF0000; text-decoration: underline}
a:visited { color: #FFFF00; ; text-decoration: underline}

Oct 30 '05 #5
VK wrote:
Why would not set link styles equal for both visited and unvisited?


Because that is one of the most incompetent things a Web site responsible
could do.
PointedEars
Oct 30 '05 #6
VK
VK wrote:
/* a:visited color rule has higher priority over
a:hover if viewed from your local drive.
To fix this bug (feature?) one should use
additional !important instruction: */
a:hover { color: #FF0000 !important; text-decoration: underline}

<http://groups.google.com/group/comp.infosystems.www.authoring.stylesheets/browse_frm/thread/936a815501359f6b/acf6ca9f1904599c?hl=en&>

Oct 31 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Stewart Midwinter | last post by:
I would like to link the contents of three OptionMenu lists. When I select an item from the first list (call it continents), the contents of the 2nd list (call it countries) would update. And in...
6
by: Shabam | last post by:
I have a text field that's pre-filled with data. Suppose the user edits it, but decides he wants to reset the data back to the original pre-filled data, how can I do that?
10
by: bnmm | last post by:
Hello, I'd like to style a submit button as regular text link. demo: www.byteshift.de/msg/div/input-as-link-by-css (XHTML strict) I applied "display:inline; margin:0; padding:0;" to both the...
0
by: Grant Rettke | last post by:
Hi folks, ASP.NET 1.1 question for you folks. I'm working on a web aplication that stores some objects in the session. What is happening is that after I reach a certain page, the session is...
26
by: Mica Cooper | last post by:
Hi, I need to pass some info in a javascript submit. <a href="javascript:document.formName.submit();">Submit Form</a> Normally a link would do page.jsp?x1=1&x2=2&x3=3 and you would pull x1,...
4
by: news.internode.on.net | last post by:
Is there any way that a STYLE attribute can be used to control the color of hyperlinks. We have a tabular output generator written in C#. Each column of the table is defined by a column, and...
1
by: Jake Barnes | last post by:
Imagine I've a function called suprise and I've a link called goSomewhereCool and I do this: document.getElementById('goSomewhereCool').onclick = surprise; Now later I want to reset the...
11
by: newbie | last post by:
i have a form in which a hidden field (initial value as '0', and my javascript set it to '1' when an event is trigged). In the same form, i have a reset field. But I realized that the hidden field...
16
by: Giovanni D'Ascola | last post by:
Hi. I noticed that <input type="reset"actually don't enable checkbutton which are checked by default after they have been disabled by javascript. It's a bug?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.