TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

April 25, 2024, 09:01:09 PM

Login with username, password and session length
Members
  • Total Members: 3,885
  • Latest: Growner
Stats
  • Total Posts: 195,173
  • Total Topics: 21,219
  • Online today: 319
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online

Make one or more of your boards stand out from the other by making it flash

Started by knat, October 19, 2006, 11:58:29 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

knat

I have a special board that only active members get access to. I wanted it to draw attention to itself when the user gets access to it so i made it flash in red.

I am no coder but i got this thing to work pretty easy so i want to share  ;)

Put this script into a script block.. select no title and frame then it will be invisible.

<script language="JavaScript1.2" type="text/javascript">

/***********************************************
* Flashing Link Script- ÂÃ,© Dynamic Drive (www.dynamicdrive.com)
* This notice must stay intact for use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

var flashlinks=new Array()

function changelinkcolor(){
for (i=0; i< flashlinks.length; i++){
var flashtype=document.getElementById? flashlinks[i].getAttribute("flashtype")*1 : flashlinks[i].flashtype*1
var flashcolor=document.getElementById? flashlinks[i].getAttribute("flashcolor") : flashlinks[i].flashcolor
if (flashtype==0){
if (flashlinks[i].style.color!=flashcolor)
flashlinks[i].style.color=flashcolor
else
flashlinks[i].style.color=''
}
else if (flashtype==1){
if (flashlinks[i].style.backgroundColor!=flashcolor)
flashlinks[i].style.backgroundColor=flashcolor
else
flashlinks[i].style.backgroundColor=''
}
}
}

function init(){
var i=0
if (document.all){
while (eval("document.all.flashlink"+i)!=null){
flashlinks[i]= eval("document.all.flashlink"+i)
i++
}
}
else if (document.getElementById){
while (document.getElementById("flashlink"+i)!=null){
flashlinks[i]= document.getElementById("flashlink"+i)
i++
}
}
setInterval("changelinkcolor()", 1000)
}

if (window.addEventListener)
window.addEventListener("load", init, false)
else if (window.attachEvent)
window.attachEvent("onload", init)
else if (document.all)
window.onload=init

</script>


The script operates by extending all links on your page with three optional attributes, which you apply to the specific link you wish to flash. Here are the attributes:

id="flashlinkID" Enables flashing on the link. Replace "ID" with an integer starting from 0 and onwards, depending on the number of flashing links you have.
flashtype=? Sets the type of flash. Set to 0 for flashing on link text, 1 for flashing on link's background
flashcolor=? Sets the color of the flash. Input color name or hex value.

All three attributes should appear concurrently in the flashing link. For example:

<a href="test.htm" id="flashlink0" flashtype=0 flashcolor="green">Example 1</a>

<a href="test.htm" id="flashlink1" flashtype=1 flashcolor="lime">Example 2</a>

Now go and rename your board like this:

<a href="url to your board" id="flashlink1" flashtype=1 flashcolor="red">name of your board</a>


Demo: [XXX PORNO CONTENT VIEW ON OWN RISK] www.gapeindex.dk

login: test
pass: test


Thanks to dynamicdrive.com for the script  8)