ich habe dir das Alertbox-Script so umgebaut, dass die Box jetzt zwei Ja/Nein Buttons besitzt und nur einmal pro Besucher erscheint
<script type="text/javascript">
<!--
/*
© Valentin Hammer
Originalversion auf
http://www.supermario.homepage.eu
*/
var Alert_Text = "";
var AlertBreite = 0;
var AlertHoehe = 0;
var AlertScrollX = 0;
var AlertScrollY = 0;
var AlertScrollSX = 0;
var AlertScrollSY = 0;
var AlertScroll = 0;
function Alertbox_Text()
{
return '\u003Ctable border="0" style="width: '+AlertBreite+'px; height: '+AlertHoehe+'px; background-color: #000000; Filter: Alpha(opacity=80); -moz-opacity: 0.8; -khtml-opacity: 0.8; opacity: 0.8; position: absolute; top: '+AlertScrollY+'px; left: '+AlertScrollX+'px">\u003Ctr>\u003Ctd> \u003C/td>\u003C/tr>\u003C/table>\u003Ctable border="0" width="'+AlertBreite+'" style="height: '+AlertHoehe+'px; position: absolute; top: '+AlertScrollY+'px; left: '+AlertScrollX+'px">\u003Ctr>\u003Ctd width="100%" align="center" valign="middle">\u003Ctable border="0" width="300" bgcolor="#FFFFFF" cellspacing="0" cellpadding="1">\u003Ctr>\u003Ctd width="100%" align="right" bgcolor="#CCCCCC" style="border: solid 1px #666666">\u003Cdiv style="width: 20px; height: 20px; border: solid 1px #000000; text-align: center; cursor: hand" onclick="javascript:Alert_nein()" onmouseover="this.style.backgroundColor = \'#EEEEEE\'" onmouseout="this.style.backgroundColor = \'\'">\u003Cfont face="Arial" size="3">X\u003C/font>\u003C/div>\u003C/td>\u003C/tr>\u003Ctr>\u003Ctd width="100%" align="center" style="border-left: solid 1px #000000; border-right: solid 1px #000000">\u003Cfont face="Arial" size="3">'+Alert_Text+'\u003C/font>\u003C/td>\u003C/tr>\u003Ctr>\u003Ctd width="100%" align="center" style="border-left: solid 1px #000000; border-bottom: solid 1px #000000; border-right: solid 1px #000000">\u003Ctable border="0">\u003Ctr>\u003Ctd>\u003Cdiv style="width: 80px; height: 20px; border: solid 1px #000000; text-align: center; cursor: hand" onclick="javascript:Alert_ja()" onmouseover="this.style.backgroundColor = \'#EEEEEE\'" onmouseout="this.style.backgroundColor = \'\'">\u003Cfont face="Arial" size="3">Ja\u003C/font>\u003C/div>\u003C/td>\u003Ctd>\u003Cdiv style="width: 80px; height: 20px; border: solid 1px #000000; text-align: center; cursor: hand" onclick="javascript:Alert_nein()" onmouseover="this.style.backgroundColor = \'#EEEEEE\'" onmouseout="this.style.backgroundColor = \'\'">\u003Cfont face="Arial" size="3">Nein\u003C/font>\u003C/div>\u003C/td>\u003C/tr>\u003C/table>\u003C/td>\u003C/tr>\u003C/table>\u003C/td>\u003C/tr>\u003C/table>';
}
function AlertV(Alerttext)
{
if(uInnerHTML==1)
{
Alert_Text = Alerttext;
AlertScroll = 1;
if(window.innerWidth)
AlertBreite = window.innerWidth;
else if(document.body.clientWidth)
AlertBreite = document.body.clientWidth;
else if(document.documentElement.clientWidth)
AlertBreite = document.documentElement.clientWidth;
if(window.innerHeight)
AlertHoehe = window.innerHeight;
else if(document.body.clientHeight)
AlertHoehe = document.body.clientHeight;
else if(document.documentElement.clientHeight)
AlertHoehe = document.documentElement.clientHeight;
Alertscroll();
document.AlertboxV.style.display = '';
document.AlertboxV.innerHTML = Alertbox_Text();
}
else
{
var c = confirm(Alerttext);
if(c==true)
Alert_ja();
else
Alert_nein();
}
}
function Alertscroll()
{
AlertScrollX = 0;
AlertScrollY = 0;
if(window.pageXOffset)
AlertScrollX = window.pageXOffset;
else if(document.body.scrollLeft)
AlertScrollX = document.body.scrollLeft;
else if(document.documentElement.scrollLeft)
AlertScrollX = document.documentElement.scrollLeft;
if(window.pageYOffset)
AlertScrollY = window.pageYOffset;
else if(document.body.scrollTop)
AlertScrollY = document.body.scrollTop;
else if(document.documentElement.scrollTop)
AlertScrollY = document.documentElement.scrollTop;
if((AlertScrollX!=AlertScrollSX)||(AlertScrollY!=AlertScrollSY))
document.AlertboxV.innerHTML = Alertbox_Text();
AlertScrollSX = AlertScrollX;
AlertScrollSY = AlertScrollY;
if(AlertScroll==1)
window.setTimeout("Alertscroll(Alert_Text)",100);
}
function Alert_schliessen()
{
document.AlertboxV.innerHTML = '';
document.AlertboxV.style.display = 'none';
AlertScroll = 0;
}
function Alert_ja()
{
/****************************************
** HIER EINEN JAVASCRIPT CODE EINFÜGEN **
****************************************/
Alert_schliessen();
}
function Alert_nein()
{
/****************************************
** HIER EINEN JAVASCRIPT CODE EINFÜGEN **
****************************************/
Alert_schliessen();
}
//-->
</script>
<form name="AlertboxV" action="" style="display: none"> </form>
<script type="text/javascript">
<!--
/*
© Valentin Hammer
Originalversion auf
http://www.supermario.homepage.eu
*/
if(document.AlertboxV.innerHTML)
var uInnerHTML = 1;
var zeigen = 1;
if((document.cookie)||(document.cookie==""))
{
if(document.cookie.indexOf("Alertbox=")<0)
document.cookie = "Alertbox=1";
else
zeigen--;
}
if(zeigen>0)
AlertV('
\u003Cimg border="0" src="http://www.adresse-deiner-webseite.de/text.gif" alt="">');
//-->
</script>
Wie von dir gewünscht, erscheint die Alertbox bei jedem Besucher einmalig, beim Öffnen der Seite.
wird aufgerufen, wenn der Besucher auf "Ja" klickt. In dieser Funktion kannst du Javascript Code einbauen, der dann ausgeführt wird. Das Gleiche bei der
geschriebenen Bereich einstellen. Für deine Alertbox habe ich schon den HTML Code für ein Bild eingebaut. Die Adresse deines Bildes musst du nur noch bei
Dieses Javascript funktioniert in allen Browsern, die die Fenstergröße und die Scrollposition auslesen können, und
unterstützen. W3C valide ist der Code auch