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
Now in other browsers the page loads perfectly and everything shows up but in firefox nothingCode:<script type='text/javascript' language='javascript' src='authinfobox.js' />
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; }




Reply With Quote