IE7 fails on dynamically adding a <form> into a <div>

Discussion in 'Javascript' started by timjowers, Dec 3, 2008.

  1. timjowers

    timjowers Guest

    Anyone have a work-around for this. Apparently this is MSFT skunk-
    security garbage. You can set stuff into the DIV dynamically but not
    if its a <form>...

    var buga;
    var bugastr="<span> __ form>dummy</form></span>";
    function demobug(){
    alert( "buga=" + buga );
    alert( "bugastr=" + bugastr );
    document.getElementById("fromListDivCustInfoPicker").innerHTML =
    bugastr;
    }

    function fixme(self) / "self" is the "this" passed from a DIV
    onmouseover
    {
    self.innerHTML='funtimes'; // works fine
    alert( "fun? [" + self.name + "] [" + self.id +"]" );
    buga="fromListDivCustInfoPicker"; // this is id of the DIV I used
    for testing
    self = document.getElementById(buga);
    alert( "fine? [" + self.name + "] [" + self.id +"]" );
    self.innerHTML='fine tums'; // works fine
    bugastr="<span> __ form>dummy</form></span>";
    demobug(); // works fine
    bugastr="<span><form>dummy</form></span>";
    demobug(); // FAILS! FAILS! FAILS. (well, works fine in FF :)
    }

    The last line results in IE7 saying:
    Error: Unknown runtime error.
    When you bring up their debugger it says:
    htmlfile:Unkown runtime error.

    <div id='fromListDivCustInfoPicker' style="border-color:black;border-
    width:5;background-
    color:white;visibility:visible;position:absolute;top:250px;left:40px;z-
    index:5;width:45%" onmouseover="fixme(this)">
    </div>

    Its been years since I did any heavy JavaScript and I'm quite
    perturbed to see the same sorry junk programming still exists in the
    form of IE. Now I remember why I quit doing javascript.You'd think
    BSGates would come off some billions and hire some QA. OK, I just
    verified in Firefox 3.0.4 and it works properly.

    So, anyone have the workaround for dynamically setting a <form> in a
    <div> in IE? Is three some whitepaper on these nasty security/bug/
    features in IE?

    TIA,
    TimJowers
    timjowers, Dec 3, 2008
    #1
    1. Advertising

  2. On Wed, 03 Dec 2008 14:00:37 -0800, timjowers wrote:

    > Anyone have a work-around for this. Apparently this is MSFT skunk-
    > security garbage. You can set stuff into the DIV dynamically but not if
    > its a <form>...


    Post a *complete* page, or URL to a page.

    I have only run across this once in IE, when I stuffing things in created
    invalid mark-up. (In my case, I was accidentally trying to put a form
    inside of a form.)

    Using the DOM methods of createElement and family is often a better
    solution than using innerHTML. (innerHTML has a number of oddities,
    often browser specific.)

    [Code snipped]

    > Its been years since I did any heavy JavaScript and I'm quite perturbed
    > to see the same sorry junk programming still exists in the form of IE.


    IE has its faults, to be sure, but this might not be one of them.

    > Now I remember why I quit doing javascript.You'd think BSGates would
    > come off some billions and hire some QA. OK, I just verified in Firefox
    > 3.0.4 and it works properly.


    Did you validate the resulting page (after manipulation) to sure that it
    did, indeed, work "properly?" Or did it simply do as expected?

    HTH,
    Jeremy
    Jeremy J Starcher, Dec 3, 2008
    #2
    1. Advertising

  3. timjowers

    David Mark Guest

    On Dec 3, 5:00 pm, timjowers <> wrote:
    > Anyone have a work-around for this. Apparently this is MSFT skunk-
    > security garbage. You can set stuff into the DIV dynamically but not
    > if its a <form>...


    Your problem has nothing to do with security.

    >
    > var buga;
    >  var bugastr="<span> __ form>dummy</form></span>";
    >  function demobug(){
    >         alert( "buga=" + buga );
    >         alert( "bugastr=" + bugastr );
    >         document.getElementById("fromListDivCustInfoPicker").innerHTML =
    > bugastr;
    >  }
    >
    > function fixme(self)   / "self" is the "this" passed from a DIV
    > onmouseover
    > {
    > self.innerHTML='funtimes';  // works fine
    > alert( "fun? [" + self.name + "] [" + self.id +"]" );
    > buga="fromListDivCustInfoPicker";   // this is id of the DIV I used
    > for testing
    > self = document.getElementById(buga);
    > alert( "fine? [" + self.name + "] [" + self.id +"]" );
    > self.innerHTML='fine tums';    // works fine
    > bugastr="<span> __ form>dummy</form></span>";
    > demobug();   // works fine
    > bugastr="<span><form>dummy</form></span>";


    First off, use valid markup. Why would you try to wrap a form in a
    span? Second, why not use appendChild and avoid innerHTML entirely?

    > demobug();   // FAILS! FAILS! FAILS. (well, works fine in FF :)
    >
    > }
    >
    > The last line results in IE7 saying:
    > Error: Unknown runtime error.
    > When you bring up their debugger it says:
    > htmlfile:Unkown runtime error.
    >
    > <div id='fromListDivCustInfoPicker' style="border-color:black;border-
    > width:5;background-


    Use valid CSS too.

    > color:white;visibility:visible;position:absolute;top:250px;left:40px;z-
    > index:5;width:45%" onmouseover="fixme(this)">
    >  </div>
    >
    > Its been years since I did any heavy JavaScript and I'm quite


    Like downloading large scripts from Dynamic Drive?

    > perturbed to see the same sorry junk programming still exists in the
    > form of IE. Now I remember why I quit doing javascript.You'd think


    This has nothing to do with the language (or IE's implementation of
    it.)

    > BSGates would come off some billions and hire some QA. OK, I just


    I don't think he works there anymore. (?)

    [snip]
    David Mark, Dec 3, 2008
    #3
  4. David Mark wrote:
    > timjowers wrote:
    >> BSGates would come off some billions and hire some QA. OK, I just

    >
    > I don't think he works there anymore. (?)


    Wikipedia says he had his last day at M$ on 2008-06-27.


    PointedEars
    --
    var bugRiddenCrashPronePieceOfJunk = (
    navigator.userAgent.indexOf('MSIE 5') != -1
    && navigator.userAgent.indexOf('Mac') != -1
    ) // Plone, register_function.js:16
    Thomas 'PointedEars' Lahn, Dec 3, 2008
    #4
  5. timjowers

    timjowers Guest

    On Dec 3, 5:08 pm, Jeremy J Starcher <> wrote:
    > On Wed, 03 Dec 2008 14:00:37 -0800, timjowers wrote:
    > > Anyone have a work-around for this. Apparently this is MSFT skunk-
    > > security garbage. You can set stuff into the DIV dynamically but not if
    > > its a <form>...

    >
    > Post a *complete* page, or URL to a page.
    >
    > I have only run across this once in IE, when I stuffing things in created
    > invalid mark-up.  (In my case, I was accidentally trying to put a form
    > inside of a form.)
    >
    > Using the DOM methods of createElement and family is often a better
    > solution than using innerHTML.  (innerHTML has a number of oddities,
    > often browser specific.)
    >
    > [Code snipped]
    >
    > > Its been years since I did any heavy JavaScript and I'm quite perturbed
    > > to see the same sorry junk programming still exists in the form of IE.

    >
    > IE has its faults, to be sure, but this might not be one of them.
    >
    > > Now I remember why I quit doing javascript.You'd think BSGates would
    > > come off some billions and hire some QA. OK, I just verified in Firefox
    > > 3.0.4 and it works properly.

    >
    > Did you validate the resulting page (after manipulation) to sure that it
    > did, indeed, work "properly?"  Or did it simply do as expected?
    >
    > HTH,
    > Jeremy



    Thanks Jeremy,

    <form> inside <form> was the problem. I did not try with DOM.

    TimJowers
    timjowers, Dec 4, 2008
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jeff Louella

    IE7 on XP vs IE7 on Vista

    Jeff Louella, Mar 1, 2007, in forum: HTML
    Replies:
    9
    Views:
    498
    Adrienne Boswell
    Mar 2, 2007
  2. K Viltersten

    <div ... /> and <div ...></div>

    K Viltersten, Mar 30, 2009, in forum: ASP .Net
    Replies:
    4
    Views:
    718
  3. Dwayne Madsen

    Q: Div A inside Div B is larger than Div B

    Dwayne Madsen, Jun 1, 2005, in forum: Javascript
    Replies:
    1
    Views:
    172
    David Dorward
    Jun 1, 2005
  4. bizt
    Replies:
    1
    Views:
    96
  5. Tom Y
    Replies:
    1
    Views:
    212
    Elegie
    Jul 12, 2011
Loading...

Share This Page