innerhtml.... produces Microsoft Internet Explorer error

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jason

    #1

    innerhtml.... produces Microsoft Internet Explorer error

    I have a web page that contains textareas. These are dynamically
    added via asp when the page loads based on database records. The user
    also has the ability to add more text areas via innerhtml. If the
    user clicks the add text area button too fast or too many times.. they
    will get the following error:

    Internet Explorer Has Encountered a Problem and Needs to Close.

    After reading msdns page about this error I doubt that there is a fix
    to this. However, any suggestions on how I could work around this
    error with a different approach than innerhtml? Any help would be
    greatly appreciated. Please see the example below.

    <html>
    <script language="javas cript">
    function addvalue(){

    myid.innerHTML += '<div id="mydiv2"><ta ble border=0 cellpadding=0
    cellspacing=0>< tr><td width=80 align="center"> &nbsp;<td><td>< textarea
    name="mytext"></textarea></td></tr></table></div>';
    }


    </script>



    <body>
    clicking too fast can cause ie
    error<table><tr ><td><table><tr ><td><table><tr ><td>
    <input type="button" OnClick="addval ue();" value="add text area">
    <div id="myid"><%
    'asp code that dynamically adds textareas

    %>
    </td></tr></td></tr></td></tr></table>
    </div>
    </body>
    </html>
  • Mick White

    #2
    Re: innerhtml.... produces Microsoft Internet Explorer error

    Jason wrote:[color=blue]
    > I have a web page that contains textareas. These are dynamically
    > added via asp when the page loads based on database records. The user
    > also has the ability to add more text areas via innerhtml. If the
    > user clicks the add text area button too fast or too many times.. they
    > will get the following error:
    >
    > Internet Explorer Has Encountered a Problem and Needs to Close.
    >
    > After reading msdns page about this error I doubt that there is a fix
    > to this. However, any suggestions on how I could work around this
    > error with a different approach than innerhtml? Any help would be
    > greatly appreciated. Please see the example below.
    >
    > <html>
    > <script language="javas cript">
    > function addvalue(){
    >
    > myid.innerHTML += '<div id="mydiv2"><ta ble border=0 cellpadding=0
    > cellspacing=0>< tr><td width=80 align="center"> &nbsp;<td><td>< textarea
    > name="mytext"></textarea></td></tr></table></div>';
    > }
    >
    >
    > </script>[/color]

    2 problems:
    myid.innerHTML s/b:
    document.getEle mentById("myid" ).innerHTML

    You need form tags.
    Mick[color=blue]
    >
    > <body>
    > clicking too fast can cause ie
    > error<table><tr ><td><table><tr ><td><table><tr ><td>
    > <input type="button" OnClick="addval ue();" value="add text area">
    > <div id="myid"><%
    > 'asp code that dynamically adds textareas
    >
    > %>
    > </td></tr></td></tr></td></tr></table>
    > </div>
    > </body>
    > </html>[/color]

    Comment

    • Bill

      #3
      Re: innerhtml.... produces Microsoft Internet Explorer error

      Thank you for the reply!! However, both of the issues you mentioned are
      taken care of on my live page. I was using that html/javascript as an
      example. What I am looking for is an alternative to using innerhtml as
      to avoid the internet explorer error. Talk to you soon.


      *** Sent via Developersdex http://www.developersdex.com ***
      Don't just participate in USENET...get rewarded for it!

      Comment

      • kaeli

        #4
        Re: innerhtml.... produces Microsoft Internet Explorer error

        In article <40841568$0$203 $75868355@news. frii.net>, jfreets@hotmail .com
        enlightened us with...[color=blue]
        > Thank you for the reply!! However, both of the issues you mentioned are
        > taken care of on my live page. I was using that html/javascript as an
        > example. What I am looking for is an alternative to using innerhtml as
        > to avoid the internet explorer error. Talk to you soon.
        >[/color]

        Use real DOM methods as applicable. See createElement, appendChild,
        createTextNode, etc.

        http://msdn.microsoft.com/library/default.asp?
        url=/workshop/author/dhtml/reference/dhtml_reference _entry.asp

        function addvalue(someNo de)
        {
        myNewElement = document.create Element("div");
        myNewElement.se tAttribute("id" ,"mydiv2");
        someNode.append Child(myNewElem ent);
        }

        e = document.getEle mentById("someD iv");
        addValue(e);

        --
        --
        ~kaeli~
        The Bermuda Triangle got tired of warm weather. It moved to
        Finland. Now Santa Claus is missing.



        Comment

        Working...