DHMTL dragable window not working.

Genius_boy001

New Member
Messages
31
Reaction score
0
Points
0
For some reason the DHTML window appears, but is not movable.
I have tested it on a blank html document and it works,
Just not on the page I want it on. Hahaha.

-Thankyou, GB

DHTML code (OPEN.html):
Code:
<style type='text/css'>

.dragme { cursor: move }

</style>


<script type='text/javascript'>

var ie = document.all;

var nn6 = document.getElementById &&! document.all;


var isdrag = false;

var x, y;

var dobj;


function movemouse( e ) {

if( isdrag ) {

dobj.style.left = nn6 ? tx + e.clientX - x : tx + event.clientX - x;

dobj.style.top = nn6 ? ty + e.clientY - y : ty + event.clientY - y;

return false;

}

}


function selectmouse( e ) {

var fobj = nn6 ? e.target : event.srcElement;

var topelement = nn6 ? HTML : BODY ;

while (fobj.tagName != topelement && fobj.className != dragme ) {

fobj = nn6 ? fobj.parentNode : fobj.parentElement;

}


if (fobj.className== dragme ) {

isdrag = true;

dobj = document.getElementById( styled_popup );

tx = parseInt(dobj.style.left+0);

ty = parseInt(dobj.style.top+0);

x = nn6 ? e.clientX : event.clientX;

y = nn6 ? e.clientY : event.clientY;

document.onmousemove=movemouse;

return false;

}

}


function styledPopupClose() {

document.getElementById( styled_popup ).style.display = none ;

}


document.onmousedown=selectmouse;

document.onmouseup=new Function( isdrag=false );

</script>

<html>
<head>
<div id='styled_popup' name='styled_popup' style='width: 380px;
height: 300px; display:block; position: absolute; top: 50px; left:
50px;'>
</head>
<body>
<table width='380' cellpadding='0' cellspacing='0' border='0'>

<tr>

<td><img height='23' width='356' src='OOO/x11_title.gif' class='dragme'></td>

<td><a href='javascript:styledPopupClose();'><img height='23' width='24' src='OOO/x11_close.gif'
border='0'></a></td>

</tr>

<tr><td colspan='2' style='background: url( OOO/x11_body.gif ) no-repeat top left; width: 380px; height: 277px;'>

Drag my window title to see me moving :-)

</td></tr>

</table>


</div>
</body>
</html>

HTML page:

Code:
<?php
session_start();
include('OPEN.html');
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>

<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" type="text/JavaScript">
<!--

function my_window()
{
window.open ('Close.php', 'newwindow', 'width=400, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, directories=no, status=no')
}


function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
<style type="text/css">
<!--
#Layer1 {
position:center;
width:160px;
height:115px;
z-index:1;
left: 296px;
top: 135px;
}
#Layer2 {
position:absolute;
width:200px;
height:115px;
z-index:1;
left: 400px;
top: 129px;
}
#Layer3 {
position:center;
width:200px;
height:115px;
z-index:1;
left: 144px;
top: 172px;
}
#Layer4 {
position:center;
width:121px;
height:115px;
z-index:1;
left: 10px;
top: 150px;
}
#Layer5 {
position:center;
width:200px;
height:115px;
z-index:2;
left: 199px;
top: 207px;
}
#Layer6 {
position:absolute;
width:62px;
height:115px;
z-index:2;
left: 116px;
top: 181px;
}
-->
</style>
</head>

<body onbeforeunload="window.location ='Close.php'; alert('Logging off...');">
<body background="fourth3.gif">
<center>
<p><img src="Banner.gif" width="671" height="117" ALIGN=TOPMIDDLE> </p>
<p><a href="#" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image3','','Profile2.GIF',1)"><img src="Profile.gif" name="Image3" width="100" height="20" border="0"></a><a href="#" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image4','','Friends2.GIF',1)"><img src="Friends.gif" name="Image4" width="100" height="20" border="0"></a><a href="#" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image5','','Online-Friends2.GIF',1)"><img src="Online-Friends.gif" name="Image5" width="100" height="20" border="0"></a><a href="#" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image6','','Games2.GIF',1)"><img src="Games.gif" name="Image6" width="100" height="20" border="0"></a><a href="#" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image7','','Videos2.GIF',1)"><img src="Videos.gif" name="Image7" width="100" height="20" border="0"></a></p>
</center>
<center>
<table width="0%" height="0" border="0">
<tr valign="top">
<td width="0%">
<div align="center"><img src="Menu.gif" width="123" height="375" ></div></td>
<td width="0"> <a href="#" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image3','','Profile2.GIF',1)"></a>
<iframe src ="start.htm" width="545px" height="700px"> </iframe> </tr>
</table>

</center>
</div>
</body>
</html>
 

jeyson65

New Member
Messages
10
Reaction score
0
Points
0
You may need to clarify what's going on but here is what I think you're saying. You're saying that OPEN.html works and that you want to add this functionality to the other HTML page but it's not working. If you could clarify what you're looking for I think I can help.

First off, I don't know how the open.html file could work. Just for good coding practices, put style and script tags inside the head tag. In a plain HTML file, there should be nothing above the head tag (except for comments and a DOCTYPE declaration).

If you could post a link to these pages so I can see what's happening (or not happening), that would be helpful as well. I could make it work myself but I don't have your images.
 

Jose Magsino

New Member
Messages
53
Reaction score
0
Points
0
If you could post a link to these pages so I can see what's happening (or not happening), that would be helpful as well. I could make it work myself but I don't have your images.

Yes, please do so, so we can help you.

By the way (just my 2 cents), how about using this dhtml window code instead of doing some experimentation on code that displays a dhtml window?
 
Last edited:
Top