...

View Full Version : Blinking Links



tagalog
07-18-2004, 02:33 AM
Hi everyone,

This is my first posting and it is a cry for help.

Can anyone let me have a script that will blink a link to another web site and stop blinking permanently when clicked on.

I know the way to get it blinking (<blink> </blink>) but I cannot get it to stop once the link has been used.

Any help would be greatly appreciated.

Sincerely,

Robert Shields
http://www.The-Robert-Shields-College.co.uk

Basscyst
07-18-2004, 05:56 PM
Is this link opening a page in a new window and you just want it not to blink for the existing session? Or are you looking to have it not blink any time they return to the page afer the link is clicked?

Basscyst

JPM
07-18-2004, 06:46 PM
Isn't <blink> ie only?

anyway, I think this would work:


<html>
<head>
<script>

var color = true

var int = setInterval('blink()',500)

function blink() {
if(color==true) {
document.getElementById('link').style.color = "#0f0"
color= false
}
else {
document.getElementById('link').style.color = "#00f"
color=true
}
}


function stopBlink() {
clearInterval(int)
}
</script>
</script>
<body>
<a href="#" id="link" onclick="stopBlink()">text</a>
</html>

gohankid77
07-18-2004, 08:31 PM
<blink> isn't IE only, but rather Netscape (and any Mozilla versions based on Netscape) only. It shouldn't blink in IE unless you used a script to create a blinking effect.

jbot
07-19-2004, 10:49 AM
<blink> isn't IE only, but rather Netscape (and any Mozilla versions based on Netscape) only. It shouldn't blink in IE unless you used a script to create a blinking effect.

i thot <blink> was NS4.x or lesser only. thot it had been deprecated under NS6+?

JPM
07-19-2004, 10:56 AM
I checked it and it works in NS6+? (no reason to use it ofcourse)

Antoniohawk
07-19-2004, 10:57 AM
[http://www.blooberry.com/indexdot/html/tagpages/b/blink.htm]

tagalog
07-19-2004, 02:35 PM
Hi everyone,

I'm gobsmacked at the help offered as to be honest, I thought I would probably not see a reply and if there was one it would be some weeks before it was posted. This forum really is Ace.

Thank you very much everyone, I really do appreciate your help.

JPM/Basscyst: I tried and tested your script JPM and it worked fine in that it linked to another page, but when I reloaded the original 'blinking' page is was still blinking. I was hoping to have it not blink any time they return to the page afer the link is clicked.

Again, my sincere thanks for your help.

JPM
07-19-2004, 03:43 PM
So if someone clicked the blinking link a week ago and returns to your page you dont want it to blink?

jbot
07-19-2004, 03:47 PM
you'd have to set a cookie to remember that state.

of course, the cookie could get cleared, in which case the user would be back to seeing your blinking webpage again.

however, it's cookies that you want to explore.

tagalog
07-19-2004, 04:17 PM
That's right JPM.

I also see the problem if cookies are cleared jbot but that would not be problem as I would be placing new links on the blinking link on a regular basis.

I really do appreciate you guys helping.

JPM
07-19-2004, 05:01 PM
hmm... not sure if I should be posting this...guess it would be doing everything you asked before giving you some hints, but :




<html>
<head>
<script>

var color = true

var int = setInterval('blink()',500)

function blink() {
if(color==true) {
document.getElementById('link').style.color = "#0f0"
color= false
}
else {
document.getElementById('link').style.color = "#00f"
color=true
}
}


function stopBlink() {
clearInterval(int)
}


//////////// cookie script from echoecho.com ////////////

function getCookie(NameOfCookie){
if (document.cookie.length > 0) {
begin = document.cookie.indexOf(NameOfCookie+"=");
if (begin != -1) {
begin += NameOfCookie.length+1;
end = document.cookie.indexOf(";", begin);
if (end == -1) end = document.cookie.length;
return unescape(document.cookie.substring(begin, end));
}
}
return null;
}

function setCookie(NameOfCookie, value, expiredays) {
var ExpireDate = new Date ();
ExpireDate.setTime(ExpireDate.getTime() + (expiredays * 24 * 3600 * 1000));

document.cookie = NameOfCookie + "=" + escape(value) +
((expiredays == null) ? "" : "; expires=" + ExpireDate.toGMTString());
}



function DoTheCookieStuff()
{
var blink = getCookie('blink');
if (blink!=null) { stopBlink() }
else { alert("TEST") }
}




</script>
</script>
<body onload="DoTheCookieStuff()">
<a href="#" id="link" onclick="stopBlink();setCookie('blink','stop',365)">text</a>
</html>


('blink','stop',365), 365 = days before cookie expires

tagalog
07-19-2004, 05:31 PM
JPM, many, many thanks. That works perfectly.

Is there anywhere you know where I can contribute a few bucks to show my appreciation, preferably through PayPal?

I always feel kindness should be rewarded in some way.

Again, my thanks.

Robert

JPM
07-19-2004, 05:49 PM
Just glad to help out, no need for money or anything.Also most of the cookie script was taken from here (http://www.echoecho.com/javascript.htm)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum