Unknown Runtime Error in IE 8

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kamepalli
    New Member
    • Jul 2010
    • 4

    #1

    Unknown Runtime Error in IE 8

    Hi folks,

    I am a new bee in Java Script and I have been facing many problems with different browsers. Most of the times it's with IE. The code I write works fine with Chrome and Firefox where as throws errors with IE. Anyways, coming to the actual problem, I have the requirement of creating a dynamic script element something like

    <script type="text/javascript" src="myUrl"> function1( args1)</script>

    I used DOM to do this and my code looks

    var hip = document.create Element('script ')
    hip.type = 'text/javascript';
    hip.src = "jscript file location";
    hip.innerHTML = sjcap( defectSet );

    Here defectSet is a fieldSet define prior to this new script element's definition and sjcap is a function in my class where I write the above piece of code.

    Now the problem is, this works perfect with chrome and throws error "Unknown runtime error" in IE. I use IE 8. I have seen similar problem in this forum. but, I couldn't see any useful solution from it.

    Few people said, IE doesn't support innerHTML for few elements like td, tr , tbody and few other says, take out "/" character in the strings.

    Could some one suggest me on how to solve this problem please.
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    Few people said, IE doesn't support innerHTML for few elements like td, tr , tbody
    that’s correct. (ref.)

    Code:
    <script type="text/javascript" src="myUrl"> function1( args1)</script>
    function1() will not exist. either use the src or the content.

    Comment

    • kamepalli
      New Member
      • Jul 2010
      • 4

      #3
      Originally posted by Dormilich
      that’s correct. (ref.)


      function1() will not exist. either use the src or the content.
      So..

      should I set this function1() as below

      hip.content = function1() rather hip.innerHTML = function1()

      Comment

      • Dormilich
        Recognized Expert Expert
        • Aug 2008
        • 8694

        #4
        much more simple. call the external source in one script tag and the define the function in another (but doing the latter dynamically is hilarious, why creating an extry script tag for a function definition, when you just can write down the function definition in the current script).

        Comment

        • kamepalli
          New Member
          • Jul 2010
          • 4

          #5
          Hello Dormilich,

          I already have this function1() defined in a separate class and somewhere in the creation of my form, I have to dynamically call this function. So, I think, I must create a script Element with src set to the other class path and the value/content/text/innerHTMl set to function1().

          This notation worked perfectly in Chrome where as giving problems in IE. I can not again write all that other class function details in my script tag. I am using DOM to create tags not writing html in strings.

          Comment

          • Dormilich
            Recognized Expert Expert
            • Aug 2008
            • 8694

            #6
            I already have this function1() defined in a separate class and somewhere in the creation of my form, I have to dynamically call this function. So, I think, I must create a script Element with src set to the other class path and the value/content/text/innerHTMl set to function1().
            nope. if that "class"* definition is already loaded, you can call that function in any other script area/tag.

            Code:
            <script type="text/javascript" src="myUrl"></script>
            Code:
            <script type="text/javascript"> function1(args1);</script>
            * - btw. JavaScript does not know the concept of Classes (like in Java or C), because it’s a prototype-based language (a completely different approach)

            Comment

            • kamepalli
              New Member
              • Jul 2010
              • 4

              #7
              Yes, that class is already loaded and that worked when used hip.innerHTML = function1() in Chrome. The problem is it's not working in IE. How to make it work in IE ??

              Comment

              Working...