GB_001 Posted February 20, 2008 Share Posted February 20, 2008 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. -Thankyou, GB DHTML code (OPEN.html): <st yle type='text/css'> .dragme { cursor: move } </st yle> <s cript type='text/j a v a s c r i p t'> 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 ); </sc ript> <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='j a v a s c r i p t: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: <?php session_start (); includ e ('OPEN.html'); ?> <!DO CTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Untitled Document</title> <m eta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <sc ript language="J a v a S c r i pt" type="text/J a v a S c r i p t"> <!-- 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];} } //--> </sc ript> <st yle type="text/c ss"> <!-- #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; } --> </ st yle> </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> Link to comment https://forums.phpfreaks.com/topic/92168-dhmtl-dragable-window-not-working/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.