172 besökare, 1 medlem och 1 Student är online nu
Loopia

webdesign och HTML

Sidtitel-scroller

Skriver meddelandet som en "typewriter-effekt" på samma ställe som sidans titel normalt visas.

Sidtiteln i detta webbläsarfönster ska "skrivas ut" om scriptet fungerar.

 

Kopiera koden och lägg inom <HEAD>

 

<HEAD>

<script language="JavaScript1.2">

var message="
Din sidtitel och meddelande här "
//specifys the title

var message=message+" "
//gives a pause at the end,1 space=1 speed unit

i="0"
//declares the variable and sets it to start at 0

var temptitle=""
//declares the variable and sets it to have no value yet.

var speed="150"
//the delay in milliseconds between lettersfunction

titler(){
if (!document.all&&!document.getElementById)
return
document.title=temptitle+message.charAt(i)
//sets the initial title

temptitle=temptitle+message.charAt(i)
//increases the title by one letter

i++ //increments the counter
if(i==message.length)
//determines the end of the message

{
i="0"
//resets the counter at the end of the message

temptitle=""
//resets the title to a blank value

}
setTimeout("titler()",speed)
//Restarts. Remove line for no-repeat.

}
window.onload=titler
</script>


</HEAD>