at lukke et vindue der er åbnet med window.createPopup()
Hej!Jeg har nedenstående kode.
Popup virker fint, og man kan også lukke den igen ved tryk på knappen.
Jeg vil dog gerne have den til at lukke når jeg i kontekstmenuen vælger "Åbn" (fed skrift) men den kommer bare med en JS fejl.
Nogen der kan lure hvordan det skal fikses?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled</title>
<script type="text/javascript">
function ShowPopup()
{
oPopup = window.createPopup();
var oPopupBody = oPopup.document.body;
oPopupBody.style.backgroundColor = "#FFFFFF";
oPopupBody.style.border = "1px solid #ACA899";
oPopupBody.style.padding = "2px";
oPopupBody.style.fontFamily = "Tahoma, Arial, sans-serif";
oPopupBody.style.fontSize = "8pt";
oPopupBody.innerHTML = "<div onclick='HidePopup()' style='cursor:default;padding-top:1px;padding-left:17px;padding-bottom:3px' onmouseover=this.style.background='#316AC5';this.style.color='#FFF' onmouseout=this.style.background='#FFF';this.style.color='#000'><strong>Åbn</strong></div><div onclick='' style='cursor:default;padding-top:1px;padding-left:17px;padding-bottom:3px' onmouseover=this.style.background='#316AC5';this.style.color='#FFF' onmouseout=this.style.background='#FFF';this.style.color='#000'>Slet</div><div onclick='' style='cursor:default;padding-top:1px;padding-left:17px;padding-bottom:3px' onmouseover=this.style.background='#316AC5';this.style.color='#FFF' onmouseout=this.style.background='#FFF';this.style.color='#000'>Omdøb</div><div onclick='' style='cursor:default;padding-top:1px;padding-left:17px;padding-bottom:3px' onmouseover=this.style.background='#316AC5';this.style.color='#FFF' onmouseout=this.style.background='#FFF';this.style.color='#000'>Flyt</div><div onclick='' style='cursor:default;padding-top:1px;padding-left:17px;padding-bottom:3px' onmouseover=this.style.background='#316AC5';this.style.color='#FFF' onmouseout=this.style.background='#FFF';this.style.color='#000'>Kopier</div>";
oPopup.show(event.clientX-15, event.clientY-15, 200, 91, document.body);
setTimeout("HidePopup();", 3000);
}
function HidePopup()
{
oPopup.hide();
}
</script>
</head>
<body>
<button onclick="ShowPopup()">Show Popup</button>
<button onclick="HidePopup()">Hide Popup</button>
</body>
</html>
