User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 422,560 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,594 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting

JavaScript problem in FF

Join Date: Dec 2006
Posts: 17
Reputation: pojke is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
pojke pojke is offline Offline
Newbie Poster

JavaScript problem in FF

  #1  
Dec 27th, 2006
Hi,
I got very very strange problem. Since 19 of december, when all FireFox in company was upgrated automaticaly, code below stopped working. Strange thing is, when i wanted to solve it, it started to work when i've putted alert() function. Here you have working and not working examples. I'll add that this function is used about 4 times on the site:

NOT WORKING SCRIPT:
  1. function loadJSintoDIV(id, url, switchdiv) {
  2. obj = document.getElementById(id);
  3.  
  4. if(obj.innerHTML == '' || !switchdiv) {
  5. oelem=document.createElement("script");
  6. oelem.src=url;
  7. oelem.type="text/javascript";
  8. oelem.defer=true;
  9. document.getElementsByTagName("head")[0].appendChild(oelem);
  10.  
  11. obj.style.height = '';
  12. obj.style.visibility = 'visible';
  13. } else {
  14. obj.innerHTML = '';
  15. obj.style.height = '0px';
  16. obj.style.visibility = 'hidden';
  17. }
  18. }

WORKING SCRIPT:
  1. function loadJSintoDIV(id, url, switchdiv) {
  2. obj = document.getElementById(id);
  3. alert('test');
  4. if(obj.innerHTML == '' || !switchdiv) {
  5. oelem=document.createElement("script");
  6. oelem.src=url;
  7. oelem.type="text/javascript";
  8. oelem.defer=true;
  9. document.getElementsByTagName("head")[0].appendChild(oelem);
  10.  
  11. obj.style.height = '';
  12. obj.style.visibility = 'visible';
  13. } else {
  14. obj.innerHTML = '';
  15. obj.style.height = '0px';
  16. obj.style.visibility = 'hidden';
  17. }
  18. }
  19.  

When press "ok" in alert popup, it works, without alert....crap...

Any ideas whats wrong?
AddThis Social Bookmark Button
Reply With Quote  
All times are GMT -4. The time now is 1:23 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC