I’ve seen in within my two years of JS progamming some weird things, about browser behaviour. But the one I’ve discovered yesterday tops them all. Some JS class uses in the Init function the document.createElement function. The Script is working fine built in within one Website even with IE. But when the Script is added to another Website, IE complaints that document.createElement isn’t supported by this Object. An alert directly before the call is executed shows:
function createElement() {
[native Code]
}

But it still doesn’t work in IE.
Someone ever encountered that problem? I’m currently missing a solutin except the try to manually create the HTML-Node.

Tags: none

Tags: document.createElement, IE, Js
2 Responses to “Internet Explorer and JavaScript problems”
  1. Steve says:

    Do you have some code sample or a website you can point to? without any source to look at it is hard to diagnose.

    I’m sure I can solve it with the source.

    Cheers,
    Steve

  2. Philipp says:

    Got it already working. The problem was the usage of “global” vars, So I didn’t used var myVar = document.createElement("div"); but myVar = document.createElement("div");. This seems to cause with some other Scripts or whatever in the special page to cause the problem.
    The used code was a more complex version of this:
    function myObj() {
    function init() {
    myVar = document.createElement("div");
    }
    }
    var test = new myObj();
    test.init();

    But as told that seems not to do the job in IE under certain curcumstances, you know why?
    That’s just for curiousity as I know that you should avoid usage of global vars where possible.

  3.  
Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">


Bad Behavior has blocked 2293 access attempts in the last 7 days.