The following script works as expected in IE but not FireFox:
Quote:
var closebutton = "cross.gif";
var raampje, xtra, ytra;
function sleepen(){
if (event.button!=1)return;
raampje = eval("maildiv");
temp1=raampje.style.posLeft;
temp2=raampje.style.posTop;
xpos=event.clientX;
ypos=event.clientY;
xtra = temp1-xpos;
ytra = temp2-ypos;
document.onmousemove=plaats;
}
function plaats(){
if (event.button==1){
raampje.style.pixelLeft=event.clientX+xtra;
raampje.style.pixelTop=event.clientY+ytra;
return false;}
}
function raam(inside, color,width,height, background){
titlecolor = "#008080";
opacitytitle = 45;
if(!width){
width = 500;
height = 325;}
if(inside.indexOf(".htm") > inside.length -6)
inside = "<iframe frameborder=0 name=\"raampje\" width="+(width-10)+" height="+(height-30)+" src=\""+inside+"\" scrolling=\"no\" ></iframe>";
if(!color)
color = "silver";
var thisspan = eval("maildiv.style")
thisspan.pixelLeft = document.body.scrollLeft + 100;
thisspan.pixelTop = document.body.scrollTop + 100;
thisspan.visibility="visible";
output = "<table cellpadding=0 cellspacing=0 width=" + width + " height=" + height + " border=3><tr>";
output += "<td onmousedown='sleepen()' style='cursor:hand' onmouseup='javascript:document.onmousemove=\"\" ' bgcolor='"+titlecolor+"' style='filter:alpha(opacity="+opacitytitle+");' width =" + width + " height=20></td><td bgcolor='silver'>";
output += "<input type='image' alt=\"Close\" onclick='closeraam()' src='"+closebutton+"'></td></tr>";
output += "<tr><td width=100% colspan=2><table ";
if(background)output += "style='background-image:url(\" " + background + "\")'";
output += " width=100% height=100% bgcolor='"+color+"'><tr><td height=100% width=100% >"+ inside+"</td></tr></table></td></tr>";
maildiv.innerHTML = output;
}function closeraam(){maildiv.style.visibility="hidden";}
function first()
{
outp = "";
outp += "<center><h2>In this window you can place everything you want.</h2>";
outp +="<p>You can type your complete HTML code in this and you can change the size,";
outp += " specify a background image or color when you don't have an image, change the color of the title bar.";
outp += "It's also possible to use an external HTML file. To use a HTML file you only";
outp += " have to specify it</p>";
raam(outp, "lightblue",400,200);
}
|
There are multiple problems but there are 2 that I can't resolve.
1) the proper implementation of GetElementbyID for maildiv
2) function sleepen() and function plaats() are suppose to allow me to drag the popup around but doesn't in FF.
FYI : This popup will be used to display a pedigree for selected individuals on a genealogy website.
Thanks in advance for any and all help provided.
I'm a js dummy so I need real simple answers.
Larry
|