getelementbyid not working in IE6 or 7

This is a discussion on "getelementbyid not working in IE6 or 7" within the JavaScript Forum section. This forum, and the thread "getelementbyid not working in IE6 or 7 are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > JavaScript Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Aug 17th, 2007, 23:01
Junior Member
Join Date: Nov 2006
Location: Los Angeles
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
getelementbyid not working in IE6 or 7

I have a simple script that swaps the css display property of a div captured through getElementById:
Code: Select all
function swapStep ()
{
    //FORM VALIDATION FUNCTION CALL GOES HERE
    
    current_step = document.getElementById('current_step');
        
    switch(current_step.innerHTML)
    {
    
    case '1':
    
      //alert('changing step from 1 to 2');
        
      alert('form validation goes here');
    
      current_step.innerHTML = '2';
    
      step1 = document.getElementById("step1");
      step2 = document.getElementById('step2');
      
      //alert(step1.currentStyle? step1.currentStyle.display : getComputedStyle(step1,null).getPropertyValue('display'));
      
      step1.style.display = 'none';
      step2.style.display= 'block';
      
      break;
      
    case '2':
    
      alert('form validation goes here');
    
      //alert('changing step from 2 to 3');    
        
      current_step.innerHTML = '3';      
      
      step2 = document.getElementById('step2');
      step3 = document.getElementById('step3');
      
      step2.style.display = 'none';
      step3.style.display= 'block';
      
      continue_button = document.getElementById('continue');
      final_submit = document.getElementById('final_submit');
      
      continue_button.style.display = 'none';
      final_submit.style.display= 'block';
      
      break;    
      
    }
    
}
I have isolated the problem to the first line of code for IE7 and IE6:
Code: Select all
current_step = document.getElementById('current_step');
If I put an alert statement before and after this line, IE7 and 6 won't display the second alert. Has anyone ever seen this before? I have never had this much trouble with the getelementbyid method in any browser.

There is a form on the page, but all form names are preceded by "input_" so I know its not a form name/div id conflict.

Any ideas? I'm totally at a loss. I can't post a link because its on an internal server.
Reply With Quote

Reply

Tags
getelementbyid, ie7

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help using document.getElementById jonnymorris JavaScript Forum 3 Mar 28th, 2008 22:52
document.getElementById and document.getElementByName is not working in FF dhineraj JavaScript Forum 3 Jul 26th, 2007 20:23
document.getElementById("userProfileCheck") is not working in Mozilla Firefox dhineraj JavaScript Forum 1 Jul 20th, 2007 05:32
document.getElementById is not working in Mozilla Firefox dhineraj JavaScript Forum 3 Jul 20th, 2007 02:31
document.getElementById[objectID].style now working on Mozilla Browser yogeshid JavaScript Forum 1 May 25th, 2007 09:30


All times are GMT. The time now is 19:23.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43