Angaben für das 2te Tutorium
2b. Schutz von Emaillinks mittels JavaScript
Das folgende JS gehört in den HEAD-Bereich des Quelltextes kopiert:
<script language="JavaScript">
<!--
function sendMailTo(name, company, domain) {
locationstring = 'mai' + 'lto:' + name + '@' + company + '.' + domain;
window.location.replace(locationstring);
}
//-->
</script> |
Dieser Teil gehört an jener Stelle des Quelltextes eingefügt, wo der Email-Link erscheinen soll:
<a href="javascript:sendMailTo('meine.name','gmx','com')">Email me (JS must be enabled)</a> |
<form action="http://www.nettz.de/Formular-Chef/Formular-Chef.cgi"
method=post enctype="multipart/form-data">
<input type="hidden" name="empfaenger" value="deine.email@hier.rein">
|
3a. Fertiges CSS in den Quellcode einbinden
<style type="text/css"> <!-- a:link {text-decoration: none; color:#0000FF;} a:visited {text-decoration: none; color:#0099FF;} a:hover {text-decoration: underline; font-weight:bold; color:#666699;} a:active {text-decoration: none; font-weight: normal; color:#ffffff;} --> </style>
|
oder:
<style type="text/css">
...
</style>
|
4. Fertiges JS in den Quellcode einbinden (Beispiel Zeit und Datum)
Das folgende JS gehört in den HEAD-Bereich kopiert:
<script language="JavaScript">
<!--
var timerID = null
var timerRunning = false
function MakeArray(size)
{
this.length = size;
for(var i = 1; i <= size; i++)
{
this[i] = "";
}
return this;
}
function stopclock (){
if(timerRunning)
clearTimeout(timerID);
timerRunning = false
}
function showtime () {
var now = new Date();
var year = now.getYear();
var month = now.getMonth() + 1;
var date = now.getDate();
var hours = now.getHours();
var minutes = now.getMinutes();
var seconds = now.getSeconds();
var day = now.getDay();
Day = new MakeArray(7);
Day[0]="SUN";
Day[1]="MON";
Day[2]="TUE";
Day[3]="WED";
Day[4]="THU";
Day[5]="FRI";
Day[6]="SAT";
var timeValue = "";
timeValue += (Day[day]) + " ";
timeValue += date + "-";
timeValue += ((month < 10) ? " 0" : "") + month + "-";
timeValue += year + " ";
timeValue += ((hours <= 12) ? hours : hours - 12);
timeValue += ((minutes < 10) ? ":0" : ":") + minutes;
timeValue += ((seconds < 10) ? ":0" : ":") + seconds;
timeValue += (hours < 12) ? " AM" : " PM";
document.jsfrm.face.value = timeValue;
timerID = setTimeout("showtime()",1000);
timerRunning = true
}
function startclock () {
stopclock();
showtime()
}
// -->
</script> |
Der folgende Teil gehört in den Hauptteil:
<body onLoad="startclock();" bgcolor=#D0D0D0> <form frameborder=0 marginheight=0 marginwidth=0 border=0
align=middle height=20 width=500 name='jsfrm'> <input name='face' size=35> </form>
|