page is invisible but no errors (firefox problem)
i know the problem has something to do with the javascript but i cant find any errors.
in the heading i load the script file
Code:
<script type='text/javascript' language='javascript' src='authinfobox.js' />
Now in other browsers the page loads perfectly and everything shows up but in firefox nothing
is visible. When i remove that line above, everything shows up. below is the code for the
javascript file.
Code:
var boxshowing = false;
function showAuthBox(authName, authAge, authLoc, index)
{
//1st check if an author info box is already showing
//if it is call hide function which also removes the info
if (boxshowing) hideAuthBox();
//get top position of (empty) authname div element
var nboxTop = document.getElementById("authnamebox["+index+"]").offsetTop;
//get top pos of its parent element, add together to get best
//positioning
var parentTop = document.getElementById('apps_parent').offsetTop;
//set the left position
var lpos = document.getElementById("authnamebox["+index+"]").offsetLeft;
var aib = document.getElementById('authinfobox');
aib.style.left = lpos+"px";
aib.style.top = nboxTop+parentTop+"px";
//create necessary html elements to display the data
var tmpdiv = document.createElement("div");
tmpdiv.setAttribute("id", "tmpdiv");
var txtNode = document.createTextNode("Name: "+authName);
tmpdiv.appendChild(txtNode);
//make line break
var br = document.createElement("br");
tmpdiv.appendChild(br);
txtNode = document.createTextNode("Age: "+authAge);
tmpdiv.appendChild(txtNode);
//found that you must call createelement each time
//for every <br> element created
br = document.createElement("br");
tmpdiv.appendChild(br);
txtNode = document.createTextNode("Location: "+authLoc);
tmpdiv.appendChild(txtNode);
br = document.createElement("br");
tmpdiv.appendChild(br);
br = document.createElement("br");
tmpdiv.appendChild(br);
//create link to close box
var htmlnode = document.createElement("a");
htmlnode.setAttribute("href", "#");
htmlnode.setAttribute("class", "closeauthbox");
htmlnode.setAttribute("onclick", "hideAuthBox()");
txtNode = document.createTextNode("close");
htmlnode.appendChild(txtNode);
tmpdiv.appendChild(htmlnode);
//add tmpdiv to authinfobox
aib.appendChild(tmpdiv);
//make it visible!
aib.style.display = "block";
boxshowing = true;
}
function hideAuthBox()
{
//get handle to authinfobox
var aib = document.getElementById('authinfobox');
//make it invisible
aib.style.display = "none";
//remove inner div that contains the info
var innerDiv = document.getElementById('tmpdiv');
aib.removeChild(innerDiv);
boxshowing = false;
}
Re: page is invisible but no errors (firefox problem)
Just supplying the JavaScript puts a lot of work on us to try to see the code in action. Why don't you upload us a full sample?
1 Attachment(s)
Re: page is invisible but no errors (firefox problem)
here are the 3 files i use (php/css/javascript)
Re: page is invisible but no errors (firefox problem)
Almost...Instead of attaching the PHP page which references the MySQL database, can you please attach an outputted HTML example?
And, have you checked Firefox's Error Console?
1 Attachment(s)
Re: page is invisible but no errors (firefox problem)
i've attached a txt file which is the outputted source. and yes, i used firebug to see if i could find an error but no errors showed up.
Re: page is invisible but no errors (firefox problem)
I'm sorry, I should have seen it before...you've invalidly terminated the script tag. Use the following instead.
Code:
<script type='text/javascript' src='authinfobox.js'></script>
Re: page is invisible but no errors (firefox problem)
Thank you sooo much!! I'm curious though, I've never read anything about it acting that way,
because isn't that proper xhtml when I close it out that way?
Re: page is invisible but no errors (firefox problem)
Firefox is famous for not rendering anything of an HTML tag is incorrect within the <head> section.