Web Hosting Talk







View Full Version : Urgent :: Issue with draggable pop-up window using Javascript


creativeartist
11-06-2009, 03:07 AM
Hi All

I have used the code in the link

http://www.codelifter.com/main/javascript/dragablelayer.html

for creating a draggable pop-up window .The div has some PHP code and html text boxes in it.The pop up works fine in IE and can be draggable.But for Mozilla the popup is appearing, but its not draggable.

The client is very unhappy as they use mozilla more.How to fix this issue?, kindly help

mattle
11-06-2009, 09:16 AM
Works for me with FF 3.5.4...

cselzer
11-06-2009, 09:38 AM
Works in safari on osx 10.6 and newest firefox on w7 pro, and moz on my linux box.. i believe it has to be something wrong your configuration settings of some sort.. delete your cache?

mattle
11-06-2009, 11:49 AM
Works in safari on osx 10.6 and newest firefox on w7 pro, and moz on my linux box.. i believe it has to be something wrong your configuration settings of some sort.. delete your cache?

...make sure JS is enabled...update your browser :)

rhosternet
11-06-2009, 01:52 PM
Code on link is working. So there's something wrong with your code.
Can you post link to your script where you using it?

creativeartist
11-07-2009, 01:43 PM
The links work for me in mozilla also.but when I embed the popup screen with buttons and textboxes and php variables, it is not working for me

If you have any new version of this script please put that here.you have any idea and suggestions to make this work?.Pls provide

PogiWeb
11-07-2009, 02:24 PM
Its also working on my end.

davidb
11-07-2009, 07:07 PM
Can you post the code with your embedded objects?

creativeartist
11-09-2009, 01:31 AM
Please see the Javascript used

<script language="JavaScript1.2">

isIE=document.all;
isNN=!document.all&&document.getElementById;
isN4=document.layers;
isHot=false;

function ddInit(e){
topDog=isIE ? "BODY" : "HTML";
whichDog=isIE ? document.all.theLayer : document.getElementById

("theLayer");
hotDog=isIE ? event.srcElement : e.target;
while (hotDog.id!="titleBar"&&hotDog.tagName!=topDog){
hotDog=isIE ? hotDog.parentElement : hotDog.parentNode;
}
if (hotDog.id=="titleBar"){
offsetx=isIE ? event.clientX : e.clientX;
offsety=isIE ? event.clientY : e.clientY;
nowX=parseInt(whichDog.style.left);
nowY=parseInt(whichDog.style.top);
ddEnabled=true;
document.onmousemove=dd;
}
}

function dd(e){
if (!ddEnabled) return;
whichDog.style.left=isIE ? nowX+event.clientX-offsetx : nowX+e.clientX-

offsetx;
whichDog.style.top=isIE ? nowY+event.clientY-offsety : nowY+e.clientY-

offsety;
return false;
}

function ddN4(whatDog){
if (!isN4) return;
N4=eval(whatDog);
N4.captureEvents(Event.MOUSEDOWN|Event.MOUSEUP);
N4.onmousedown=function(e){
N4.captureEvents(Event.MOUSEMOVE);
N4x=e.x;
N4y=e.y;
}
N4.onmousemove=function(e){
if (isHot){
N4.moveBy(e.x-N4x,e.y-N4y);
return false;
}
}
N4.onmouseup=function(){
N4.releaseEvents(Event.MOUSEMOVE);
}
}

function hideMe(){
if (isIE||isNN) whichDog.style.visibility="hidden";
else if (isN4) document.theLayer.visibility="hide";
}

function showMe(){
if (isIE||isNN) whichDog.style.visibility="visible";
else if (isN4) document.theLayer.visibility="show";
}

document.onmousedown=ddInit;
document.onmouseup=Function("ddEnabled=false");

</script>

Here is the HTML inlcuded in the page


<div id="theLayer" style="position:absolute; left:100px; top:-100px; visibility:hidden; background-color:white; width:500px; overflow:none; z-index:5000" class="boxborder">

<div id="titleBar" style="cursor:move;" align="center" class="headerrow">
<ilayer width="100%" onSelectStart="return false">
<layer width="100%" onMouseover="isHot=true;if (isN4) ddN4(theLayer)" onMouseout="isHot=false">
<b class="smaller">Click and drag here to move this window</b>
</layer>
</ilayer>
</div>

<div style="background-color:#BBDDBB; border:1px solid #699869; padding:5px" width="100%">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<input type="checkbox" name="includein" value="{{$Quote}}" onClick="changeIn()" {{$Checked}} class="blank" /> Include {{$Vendor}}?
<select name="type" id="type" onChange="setIns()">
{{$Options}}
</select>
</td>
<td>
<input type="text" name="visibleIns" size="10" style="border:none; background-color:transparent; font-weight:bold; text-align:right" onFocus="this.blur()" value="{{$ccode}}{{$Quote}} {{$Cur}}"/>
<input type="hidden" name="ins" value="0" />
</td>
</tr>
</table>
</div>

<br />

<div><a href="#" onClick="'','width=500,height=600,scrollbars=yes'); return false;">{{$Lnk}}</a></div>

<p>{{$Des}}</p>

<br />

<div align="center"><input type="button" value="Click here to close" onClick="hideMe();return false" align="middle" {{$Bcode}} /></div>

</div>

{{else}}
<input type="hidden" name="type" id="type" value="{{$pid}}" />
<input type="hidden" name="Amount" value="0" />
{{/if}}

</div>

Why it is not working?