Guys,
I' writing a small auto window generator script, but am having a slight problem.
The functions I have to move the window while holding the mouse button down are not working corectly.
If you move the mouse too quick, the window gets left behind.
Any ideas...????
-------------------------------------------------------
<html>
<head>
<title></title>
<script language="JavaScript">
<!--
var dragWinObj,x,y
function moveWin(){
if (event.button==1){
if(dragWinObj!=null){
if(dragWinObj.type=='dragWin'){
dragWinObj.style.pixelLeft=PL+event.clientX-x
dragWinObj.style.pixelTop=PT+event.clientY-y
return false
}
}
}
}
function dragWin(what){
x=event.clientX
y=event.clientY
dragWinObj=what
PL=dragWinObj.style.pixelLeft
PT=dragWinObj.style.pixelTop
dragWinObj.style.cursor='move'
}
function dropWin(){
dragWinObj.style.cursor='default'
}
function closeWin(what){
document.getElementById(what).style.display='none'
}
titleTxtFont= 'ms sans serif'
titleBgColor= 'activecaption'
titleTxtColor= 'captiontext'
titleStyle= ''
//titleStyle= 'filterrogidXImageTransform.Microsoft.gradient(enabled=\'true\',gradientType=\'1\',startColorstr=\'#800000\', endColorstr=\'white\')'
mainBgColor= 'Window'
function makeWindow(where,T,L,H,W,title,titlePic){
document.getElementById(where).innerHTML='<table border="0" cellspacing="0" style="position:absolute;top:'+T+';left:'+L+';width:'+W+';height:'+H+';cursor:default;border:2 outset;z-index:1000;" type="dragWin"><tr onmousedown="dragWin(this.parentElement.parentElement)" onmouseup="dropWin()" onmousemove="moveWin()" onselectstart="return false;" style="background:'+titleBgColor+';color:'+titleTxtColor+';font-family:'+titleTxtFont+';font-size:10;height:20;"><td style="height:20;'+titleStyle+'"><img align="absmiddle" src="'+titlePic+'" width="17" height="15" border=0 alt="" ondragstart="return false"><b>'+title+'</b><div style="position:absolute;top:1;right:1;height:0;font-family:webdings;font-size:10;width:15;cursorointer;" align="center" onclick="closeWin(\''+where+'\')" title="Close"><b>r</b></div></td></tr><tr><td cellpadding="5" style="border:1 inset;background:'+mainBgColor+';" valign="top"><div id="'+where+'_body" style="height:100%;width:100%;overflow:auto;"></div></td></tr></table>'
}
//-->
</script>
</head>
<body>
<div id="win_1">
<script>
makeWindow('win_1',100,100,300,450,'Window 1','computer.gif')
win_1_body.innerHTML='Test Window<br><br>Test Window<br><br>Test Window<br><br>Test Window<br><br>Test Window<br><br>Test Window<br><br>Test Window<br><br>Test Window<br><br>Test Window<br><br>Test Window<br><br>Test Window<br><br>Test Window<br><br>Test Window<br><br>Test Window<br><br>Test Window<br><br>Test Window<br><br>Test Window<br><br>Test Window<br><br>Test Window<br><br>'
</script>
</div>
</body>
</html>
http://www.pwhitrow.com