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)
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?
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.