PDA

View Full Version : Problem with Combo in IE



mrran
23 Apr 2007, 1:55 PM
Hey. i'm having a weird problem with multiple comobos in IE.
in FF it works perfect without any errors at the error console.

here is the code.

while (document.getElementsByTagName('select').length > 0) {
var spans = document.getElementsByTagName('select');
if (spans.length){
new Ext.form.ComboBox({
typeAhead: true,
triggerAction: 'all',
transform:spans[0]
});
}
}

it should transform all selects in a page to combo box, however, in IE (7) when i load that page it says
'Internet explorer cannot open the Internet site
http://.......

Operation aborted'

any thoughts? any help would be appreciated. thanks in advanced!

mapo
23 Apr 2007, 2:36 PM
Sounds something like

http://techflock.blogspot.com/2007/03/internet-explorer-operation-aborted.html

you should try to execute your JavaScript in a Ext.onReady function, if you aren't already doing that...

MAssimo

stever
23 Apr 2007, 2:53 PM
Messing with the DOM tree in IE is very tricky until it fully processed. I've had great success if I follow this rule:

The script changing the DOM must be at the body level. If not in the body level, then it must be in a TD and only alter things in that TD.

Thus lots of people didn't come across this error when using tables for layout. Change to DIV's and CSS, and bam! Now everyone seems to be seeing it. Anyhow, I've had a bit of success by using tables to create safe zones in IE for in-line scripting of the DOM.

benny
24 Apr 2007, 3:54 AM
I'm having the exact same problem with IE6.
The code is called using 'Ext.EventManager.onDocumentReady.....'

Perhaps this function does not work as intended in IE (i.e. perhaps IE states ready when it's not!)

tryanDLS
24 Apr 2007, 9:05 AM
Do you actually have more than 1 select? If so, your code is trying transform the same one multiple times, since you're using spans[0]. In addition, that's not a very good coding structure. Why would you call getElements multiple times? Do it once and assign the result to var.