Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
JS works in IE not in FireFox
Old 07-30-2006, 03:49 PM JS works in IE not in FireFox
Junior Talker

Posts: 1
Name: Larry McCaughn
Trades: 0
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
tlmccaughn is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 08-01-2006, 01:05 AM Re: JS works in IE not in FireFox
funkdaddu's Avatar
Web Design Snob

Posts: 635
Trades: 0
Can I see the whole page, or link to it?

The correct way to get an element by id is like this:
var x = document.getElementById("maildiv");
funkdaddu is offline
Reply With Quote
View Public Profile Visit funkdaddu's homepage!
 
Reply     « Reply to JS works in IE not in FireFox
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.10260 seconds with 12 queries