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.