Avatar billede gevon Nybegynder
10. oktober 2002 - 18:57 Der er 2 kommentarer

Dhtml spørgsmål

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>

<script>

//DHTML Window script- Copyright Dynamic Drive (http://www.dynamicdrive.com)
//For full source code, documentation, and terms of usage,
//Visit http://www.dynamicdrive.com/dynamicindex9/dhtmlwindow.htm

var dragapproved=false
var minrestore=0
var initialwidth,initialheight
var ie5=document.all&&document.getElementById
var ns6=document.getElementById&&!document.all

function drag_drop(e){
if (ie5&&dragapproved&&event.button==1){
document.getElementById("dwindow").style.left=tempx+event.clientX-offsetx
document.getElementById("dwindow").style.top=tempy+event.clientY-offsety
}
else if (ns6&&dragapproved){
document.getElementById("dwindow").style.left=tempx+e.clientX-offsetx
document.getElementById("dwindow").style.top=tempy+e.clientY-offsety
}
}

function initializedrag(e){
offsetx=ie5? event.clientX : e.clientX
offsety=ie5? event.clientY : e.clientY
if (ie5)
document.getElementById("saver").style.display=''

tempx=parseInt(document.getElementById("dwindow").style.left)
tempy=parseInt(document.getElementById("dwindow").style.top)

dragapproved=true
document.onmousemove=drag_drop
}

function loadwindow(url,width,height){
if (!ie5&&!ns6)
window.open(url,"","width=width,height=height,scrollbars=1")
else{
document.getElementById("dwindow").style.display=''
document.getElementById("dwindow").style.width=initialwidth=width
document.getElementById("dwindow").style.height=initialheight=height
document.getElementById("dwindow").style.left=30
document.getElementById("dwindow").style.top=ns6? window.pageYOffset*1+30 : document.body.scrollTop*1+30
document.getElementById("cframe").src=url
}
}

function maximize(){
if (minrestore==0){
minrestore=1 //maximize window
document.getElementById("maxname").setAttribute("src","restore.gif")
document.getElementById("dwindow").style.width=ns6? window.innerWidth-20 : document.body.clientWidth
document.getElementById("dwindow").style.height=ns6? window.innerHeight-20 : document.body.clientHeight
}
else{
minrestore=0 //restore window
document.getElementById("maxname").setAttribute("src","max.gif")
document.getElementById("dwindow").style.width=initialwidth
document.getElementById("dwindow").style.height=initialheight
}
document.getElementById("dwindow").style.left=ns6? window.pageXOffset : document.body.scrollLeft
document.getElementById("dwindow").style.top=ns6? window.pageYOffset : document.body.scrollTop
}

function closeit(){
document.getElementById("dwindow").style.display="none"
}

if (ie5||ns6)
document.onmouseup=new Function("dragapproved=false;document.onmousemove=null;document.getElementById('saver').style.display='none'")

</script>


  <!--
  <SCRIPT SRC="http://www.netstars.dk/ex/go.asp?id=1044" TYPE="text/javascript"></SCRIPT>
-->


<link rel="stylesheet" href="setup.css">
    <title>Gardi</title>
</head>

<body>
<br>
<br>
<br>
<br>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
   
<title></title>
<body>

   
<div align="center"> </div>

</body>
</html>

</div>
<div id="dwindow" style=" filter:alpha(opacity=96) FILTER: progid:DXImageTransform.Microsoft.Shadow(direction=135,color=black,strength=2); position:absolute;background-color:#f2f2f2;cursor:hand;left:0;top:0;display:none" onMousedown="initializedrag(event)" onSelectStart="return false">


<table border="1" bordercolor="#000000" cellpadding="0" cellspacing="0" height="10" width="100%">
<tr>
    <td bordercolor="#f2f2f2">

    <span style="color:#db9122;">•</span> Ferie tid


    </td>
    <td bordercolor="#f2f2f2"><div align="right"><img src="close.gif" onClick="closeit()"></div></td>
</tr>
</table>

</td>
</tr>
</table>
<iframe id="cframe" scrolling="No" frameborder="0" style="Border-color:black;" src="" width=100% height=100%></iframe>
<div id="saver" style="width:100%;height:100%;position:absolute;left:0;top:0;display:none"></div>
</div>

<script>
//Use below code to load DHTML Window as page loads
if (ns6) window.onload=new Function('loadwindow("http://www.newz.dk",200,200)')
else
loadwindow("http:www.newz.dk",200,200)
</script>

<!--Use below code to load DHTML window via link
<a href="java script:loadwindow('http://www.geocities.com',600,400)">Geocities</a>-->
</body>
</html>





- - -- - - -- - - -- - - - - - -- -- - -- - - - - -- -
Så kommer spørgsmålet:

Kan jeg få det vindue som åbner til at komme ind på midten, eller på et specielt kordinat ?
Avatar billede sirerugor Nybegynder
14. februar 2003 - 12:30 #1
ja  ... du kan sætte top og left koordinater..
Avatar billede sirerugor Nybegynder
14. februar 2003 - 12:36 #2
function loadwindow(url,width,height,left,top){
if (!ie5&&!ns6)
window.open(url,"","width=width,height=height,left=left,top=top,scrollbars=1")
else{
document.getElementById("dwindow").style.display=''
document.getElementById("dwindow").style.width=initialwidth=width
document.getElementById("dwindow").style.height=initialheight=height
document.getElementById("dwindow").style.left=30
document.getElementById("dwindow").style.top=ns6? window.pageYOffset*1+30 : document.body.scrollTop*1+30
document.getElementById("cframe").src=url
}
}
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Vi tilbyder markedets bedste kurser inden for webudvikling

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester