Results 1 to 6 of 6

Thread: Modal Doesn't Work in IE

  1. #1
    Join Date
    Jun 2007
    Posts
    543
    Thanks
    3
    Thanked 78 Times in 78 Posts
    Blog Entries
    1

    Default Modal Doesn't Work in IE

    I made this modal script and it works perfectly in firefox, but it doesn't work in IE please help.
    http://masterproject.freehostia.com/test/drag.html
    Last edited by Snookerman; 04-22-2009 at 07:43 AM. Reason: added "Resolved" prefix
    [Jasme Library (Javascript Motion Effects)] My Site
    /\/\@§†ê® §©®¡þ† /\/\@|{ê®
    There are 10 kinds of people in the world, those that understand binary and those that don't.

  2. #2
    Join Date
    Feb 2008
    Posts
    17
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    First rule of coding HTML: use a valid doc type at the top of your HTML document. That's probably why it doesn't work in IE.

  3. #3
    Join Date
    Jun 2007
    Posts
    543
    Thanks
    3
    Thanked 78 Times in 78 Posts
    Blog Entries
    1

    Default

    i tried it with a valid doctype and it didn't work.
    [Jasme Library (Javascript Motion Effects)] My Site
    /\/\@§†ê® §©®¡þ† /\/\@|{ê®
    There are 10 kinds of people in the world, those that understand binary and those that don't.

  4. #4
    Join Date
    Jun 2007
    Posts
    543
    Thanks
    3
    Thanked 78 Times in 78 Posts
    Blog Entries
    1

    Default

    can anyone help?
    [Jasme Library (Javascript Motion Effects)] My Site
    /\/\@§†ê® §©®¡þ† /\/\@|{ê®
    There are 10 kinds of people in the world, those that understand binary and those that don't.

  5. #5
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    You cannot:

    Code:
     . . . setAttribute("style", . . .
    or:

    Code:
     . . . setAttribute("class", . . .
    in IE.

    Code:
     . . . setAttribute("onClick", . . .
    probably will not work in IE either, I'm not sure. To be safe, use:

    Code:
    el.onclick=function(){whatever();};
    or use the addEventListener() and attachEvent() methods.

    A cross browser substitute for the style bit is to set each individual property/value pair, ex:

    Code:
    md.style.width=this.width+"px";
    md.style.height=this.height+"px";
    md.style.cursor=this.title!=false?"":"move";
    A cross browser substitute for the class bit is, ex:

    Code:
    mt.className="drag title";
    The setAttribute() method is fraught with other subtle issues, and so should only be used when direct assignment will not work. Example of direct assignments that work (the second of course is only for elements that support the href attribute and url is a defined string var):

    Code:
    el.id='some_id';
    el.href=url;
    Pretty much all the basic ones and even many of the more esoteric things work this way. The setAttribute() method is good for when the case of the attribute and/or its value is critical in IE, then you can do:

    Code:
    el.setAttribute('frameborder', 1, 0);
    the 0 tells IE that regardless of whether or not it should be FRAMEBORDER, or FrameBorder, or frameBorder, IE should just do it right. Other browsers don't care anyway (at least in most cases).

    And setAttribute() sometimes just must be used, as doing it any other way (short of writing out the element) won't work.

    IE 7 handles fixed position correctly, so you should consider making your conditional:

    Code:
    <!--[if IE]>
    Code:
    <!--[if lt IE 7]>
    But, IE 7 may need help with some of those other styles anyway, so this is a decision to be made once you get the other stuff working.

    Now, I'm not sure about much of the rest of the code, as we don't really get to see it in action with all these other 'errors', as IE doesn't see the intended created markup to begin with, so thinks that there is nothing to do. Take care of these issues and we shall see what happens.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  6. The Following 2 Users Say Thank You to jscheuer1 For This Useful Post:

    boogyman (04-28-2008),Master_script_maker (04-28-2008)

  7. #6
    Join Date
    Jun 2007
    Posts
    543
    Thanks
    3
    Thanked 78 Times in 78 Posts
    Blog Entries
    1

    Default

    Thank you so much, it worked!
    [Jasme Library (Javascript Motion Effects)] My Site
    /\/\@§†ê® §©®¡þ† /\/\@|{ê®
    There are 10 kinds of people in the world, those that understand binary and those that don't.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •