By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,537 Members | 1,750 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,537 IT Pros & Developers. It's quick & easy.

Javascript/Ajax problem in FF

P: 1
I am using some javascript/ajax to load content into a main div. The problem I am running into is that it will work in IE but not in FF. In FF I don't get any sort of load at all. I have a 1 column 2 row setup in css. The links are in the top div and the content loads in the main div. The only problem I thought may have been causing it was that I had an ID inside of and ID. I changed my links div to a class instead of an ID and that didn't seem to help. Here is all the css:

Expand|Select|Wrap|Line Numbers
  1. <style type="text/css">
  2.  
  3.  
  4. #header{
  5. background-color:white;
  6. height:100px;
  7. }
  8.  
  9. #center {
  10. background-color:white;
  11. min-height:650px; /* for modern browsers */
  12. height:auto !important; /* for modern browsers */
  13. height:650px; /* for IE5.x and IE6 */
  14. }
  15. </style>
  16. <style type="text/css">
  17.  
  18. .underlinemenu{
  19. margin: 0;
  20. padding: 0;
  21. }
  22.  
  23. .underlinemenu ul{
  24. margin: 0;
  25. margin-bottom: 1em;
  26. padding-left: 0;
  27. float: left;
  28. font-weight: bold;
  29. width: 100%;
  30. border: 1px solid #DFDFDF;
  31. border-width: 1px 0;
  32. }
  33.  
  34. * html .underlinemenu ul{ /*IE only rule. Delete extra margin-bottom*/
  35. margin-bottom: 0;
  36. }
  37.  
  38. .underlinemenu ul li{
  39. display: inline;
  40. }
  41.  
  42.  
  43. .underlinemenu ul li a{
  44. float: left;
  45. color: gray;
  46. font-weight: bold;
  47. padding: 2px 6px 4px 6px;
  48. text-decoration: none;
  49. background: white url(media/menudivide.gif) top right repeat-y;
  50. }
  51.  
  52. .underlinemenu ul li a:hover{
  53. color: black;
  54. background-color: #F3F3F3;
  55. border-bottom: 4px solid black;
  56. padding-bottom: 0;
  57. }
  58.  
  59. </style>
  60.  
And here is the Javascript/Ajax I used:

Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">
  2.  
  3. /***********************************************
  4. * Dynamic Ajax Content-  Dynamic Drive DHTML code library (www.dynamicdrive.com)
  5. * This notice MUST stay intact for legal use
  6. * Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
  7. ***********************************************/
  8.  
  9. var bustcachevar=1 //bust potential caching of external pages after initial request? (1=yes, 0=no)
  10. var loadedobjects=""
  11. var rootdomain="http://"+window.location.hostname
  12. var bustcacheparameter=""
  13.  
  14. function ajaxpage(url, containerid){
  15. var page_request = false
  16. if (window.XMLHttpRequest) // if Mozilla, Safari etc
  17. page_request = new XMLHttpRequest()
  18. else if (window.ActiveXObject){ // if IE
  19. try {
  20. page_request = new ActiveXObject("Msxml2.XMLHTTP")
  21. }
  22. catch (e){
  23. try{
  24. page_request = new ActiveXObject("Microsoft.XMLHTTP")
  25. }
  26. catch (e){}
  27. }
  28. }
  29. else
  30. return false
  31. page_request.onreadystatechange=function(){
  32. loadpage(page_request, containerid)
  33. }
  34. if (bustcachevar) //if bust caching of external page
  35. bustcacheparameter=(url.indexOf("?")!=-1)? "&"+new Date().getTime() : "?"+new Date().getTime()
  36. page_request.open('GET', url+bustcacheparameter, true)
  37. page_request.send(null)
  38. }
  39.  
  40. function loadpage(page_request, containerid){
  41. if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1))
  42. document.getElementById(containerid).innerHTML=page_request.responseText
  43. }
  44.  
  45. function loadobjs(){
  46. if (!document.getElementById)
  47. return
  48. for (i=0; i<arguments.length; i++){
  49. var file=arguments[i]
  50. var fileref=""
  51. if (loadedobjects.indexOf(file)==-1){ //Check to see if this object has not already been added to page before proceeding
  52. if (file.indexOf(".js")!=-1){ //If object is a js file
  53. fileref=document.createElement('script')
  54. fileref.setAttribute("type","text/javascript");
  55. fileref.setAttribute("src", file);
  56. }
  57. else if (file.indexOf(".css")!=-1){ //If object is a css file
  58. fileref=document.createElement("link")
  59. fileref.setAttribute("rel", "stylesheet");
  60. fileref.setAttribute("type", "text/css");
  61. fileref.setAttribute("href", file);
  62. }
  63. }
  64. if (fileref!=""){
  65. document.getElementsByTagName("head").item(0).appendChild(fileref)
  66. loadedobjects+=file+" " //Remember this object as being already added to page
  67. }
  68. }
  69. }
  70. </script>
And here is the body:

Expand|Select|Wrap|Line Numbers
  1. <body>
  2. <div id="header">
  3.         <div class="underlinemenu">
  4.         <ul>
  5.         <li><a href="javascript:ajaxpage('announcements.html', 'center');" title="Announcements">Announcements</a></li>
  6.         <li><a href="bulk_email.html" title="Bulk Email">Bulk Email</a></li>
  7.         <li><a href="calendar_admin.html" title="Calendar Admin">Calendar Admin</a></li>
  8.         <li id="current"><a href="coaches.html" title="Coaches">Coaches</a></li>
  9.         <li><a href="coordinators.html" title="Coordinators">Coordinators</a></li>
  10.         <li><a href="division.html" title="Division">Division</a></li>
  11.         </ul>
  12.         </div>
  13.  
  14. </div>
  15. <div id="center">
  16. </div>
  17.  
  18. </body>
Any help would be appreciated. Even a hint as to where it could be faulting at would be awesome. And if you do know how to fix it, if you could explain why I got what i got, I would appreciate that as well. Always trying to learn:)
May 3 '07 #1
Share this Question
Share on Google+
1 Reply


iam_clint
Expert 100+
P: 1,208
in firefox goto tools and something like javascript console and look for errors on your page.
May 3 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.