Bij druk op knop pop-up weergeven.

Status
Niet open voor verdere reacties.

Silverrwebdesig

Nieuwe gebruiker
Lid geworden
20 jun 2008
Berichten
1
Beste lezer,

ik heb nu de volgende code:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>drop down div with cookie disablement</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="Content-Script-Type" content="text/javascript"/>
<meta name="Content-Style-Type" content="text/css"/>

<style type="text/css">
/*<![CDATA[*/

body {
    background-color:#000000;
    color:#000;
}
#container {
    width:400px;
    height:200px;
    background-color: #666666;
    border:1px solid #FFFFFF;
    position:absolute;
    top:50%;                                 /*height value plus 20px;*/
    left:50%;
    margin-left:-200px;  
	margin-top:-100px;                       /*half the width value*/
    font-family:verdana,sans-serif;
    font-size:11px;
    color:#FFFFFF;
}
#container p {
    text-align:justify;
    margin:10px;
}

/*//]]>*/
</style>

<script type="text/javascript">
//<![CDATA[

  var i=-330;                               // this is the same as the "#container" top value
  var speedDown=100000;                         // this is the div drop down speed in milliseconds
  var speedOut=1000000000000000000000000000000000000;                       // this is the div display time in milliseconds

function setCookie() {

  var now = new Date();
      now.setTime(now.getTime() + 30*24*60*60*1000);          //this is set for thirty days
  var expString = "; expires=" + now.toGMTString();
    document.cookie = 'Div_='+which+expString;

}

function dropDiv() {
if (!/Div_=(\d)/.test(document.cookie)) {
    document.getElementById("container").style.top=i+"px";

if(i<50) {
  i+=8;
    dropper=setTimeout("dropDiv()",speedDown);
} 
else {
    clearTimeout(dropper);
    setInterval('removeDiv()',speedOut);
  }
 }
}
function removeDiv() {
    document.getElementById("container").style.display="none";
    which=1; 
    setCookie();
}
onload=dropDiv;

//]]>
</script>
</head>
<body>

<div id="container">
<p>
Login
</p>
 
</div>

</body>
</html>

Deze pop-up werkt perfect.
Nu zou ik alleen willen dat zodra je op een knop drukt de popup pas tevoorschijn schijn komt in plaats van als die de pagina laadt.
Ik heb al verscheidene dingen geprobeerd maar het lukt me maar niet,
kan iemand mij helpen?
 
Status
Niet open voor verdere reacties.
Terug
Bovenaan Onderaan