Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IE6 driving me mad, form keeps hanging 2

Status
Not open for further replies.

1DMF

Programmer
Jan 18, 2005
8,795
GB
not sure if this is a JS or DOM issue, but i'm sure you lot will oops-up-side-me-head if it is, so here goes...

I have a form, on it is a select list (Lender), which has an event onchange, which basically checks to see if the selection is a specific value (Other) and if it is it unhides a hidden div.

This works fine in IE7, FF, Opera, Safari , but freezes in IE6 when 'Other' is selected.

Can anyone tell me why?

here is the test url
Code:
[URL unfurl="true"]http://www.homeloanpartnership.com/test.html[/URL]

thanks, 1DMF

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!
 
I don't have ie6 to test but i think it may be because of the way you reference your select list value.
Code:
var q = document.getElementById(lend);
if ([COLOR=red]q.value[/color] == 'Other')

something like
Code:
if(q.options[q.selectedIndex].value =="Other")

syntax is prolly wrong but you get the idea. I couldn't see anything else wrong the code so i googled for a bit with no luck cept one thread. Again i can't test it but that may be worth looking into.
 
hmmm , it's a bit odd though, because if i stip the form down to have just the selectlist and remove all JS code except the check_lender , it works fine in IE6.

You'd expect it to not work regardless if it was a case of object.value no existing, wouldn't you?

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!
 
ok , it's not that, (but your code does work ;-) )

If I put an alert instead of the style change it works no problem, it's this line that is causing the problem...

Code:
document.getElementById('olend').style.visibility = 'visible';

Now why would making a hidden div visible crash the browser?

I've scanned the code and there is definately only one ID of 'olend' , why is this happening?

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!
 
That's even worse, the display='none' is hanging the browser, which the visibility='hidden' , did not...

Code:
function check_lender(lend) {
       
    if (lend.value == 'Other'){
          document.getElementById('olend').style.display = 'block';
          
    }
    else{document.getElementById('olend').style.display = 'none';}
    
}

agghh , this is so annoying!

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!
 
I've scanned the code and there is definately only one ID of 'olend'

Actually, there are NO elements on the page with an ID of "olend"... perhaps this is why it's not doing anything?

Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
hahah good eyes i been looking at the page every now and then wondering why it wouldn't work in ie6.. but maybe it changed i could of sworn it had the correct id.
 
Dan, sorry to send you on a bum steer, but j4606 is correct, I had tried changing the ID names , to see if it made a difference, i'd changed it back but forgot to upload it again.

the correct 'olend' version is back up, and it still doesn't work in IE6.

this one has got me!



"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!
 
Well - I can't tell you why it's happening - but I can tell you how to fix it.

If you move all of your hidden inputs (the ones right above the first fieldset) to right before the closing form tag (after the table), then the problem goes away.

It's clearly a glitch, but there you go. I didn't try removing the tables - although you might consider doing that given the layout isn't too complex.

Anyway - this is one less thing you have to worry about ;-)

Dan




Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
lol - nice one Dan.

How weird is that, don't you just love IE6!

I hear what your saying about the table and things, and I did have it all in pure CSS, but I was having a mare with IE6 laying it our right.

Plus because the template is used for an emailed copy, the formating is even more of a problem when it gets to outlook.

So as it's inhouse and specific to a captive company audience, i broke a few rules to patch it up.

I know not ideal, but it works ;-)

at least as you say i don't have to worry about this one anymore.

much obliged :)

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!
 
Oh yes - I found it with the age-old 'last resort' debugging for this sort of thing... Remove loads of code until it works, then add things back in until it crashes :). Repeat until you find the cause, then try reworking it to fix the problem.

It's always a nightmare when things get to that stage, but it'll normally do the trick.

Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Dan, I've done a bit of testing with this same problem (different forum) and no matter which method I used to select and show/hide the elements IE6 crashed.


Odd that moving the hidden fields should make the difference ( or maybe not given the fact that it's IE )

Chris.

Indifference will be the downfall of mankind, but who cares?
Woo Hoo! the cobblers kids get new shoes.
People Counting Systems

So long, and thanks for all the fish.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top