-
27 Apr 2010 6:05 PM #1
Help with DomHelper.append function
Help with DomHelper.append function
Hello,
I need to ask a little help with DomHelper object.
I want to create a tag script.
In FF alert returned [Object HTMLScriptElement],Code:var t = Ext.DomHelper.append(Ext.getBody() , { language: 'javascript', tag: 'script', type: 'text/javascript', src : 'Index1.js' }); alert(t);
But in IE message is [Object HTMLDivElement].
-
28 Apr 2010 10:49 AM #2
-
28 Apr 2010 12:34 PM #3
There is a strange issue with IE when you insert script into the dom. IE treats script tags as NoScope element, similar to comments and style tags. Also, any scripts you inject must have defer set, don't ask me why. I tested this in IE and it works fine.
You could replace the hidden input with a div, or some other element, it just needs it for insertion to work.Code:var t = Ext.DomHelper.insertHtml('beforeEnd', Ext.getBody().dom, '<input type="hidden"/>' + unescape('%3Cscript type="text/javascript" src="Index1.js" defer="defer"%3E%3C/script%3E'));
With that said, it seems odd that you would need to inject a script tag in this way, why not just include it when you load the file?- Clint Nelissen


Reply With Quote