SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Jul 2010
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Browser detection for expanding width SELECT column, IE not working right.(JS & HTML)

    Hey all,

    http://www.lindesigns.us/rma/rmaonline.php

    If you go to that site on Firefox, the "Return Code #" expands. But if you use IE, you'll see that it doesn't.

    I could add a fix in there for the fields if they were static, but if you see my javascript, they are dynamically loading fields.


    This "class":"wide" is not working:

    Code:
    invoiceInput.appendChild(createElement("input", {"type":"text", "name":"invoice[]", "size":"8", "class":"wide;"}));

    I am using a script I found on a jQuery board (http://jsbin.com/acado/6), and it works for them, but not for me because my syntax is probably wrong. And they also are just using 1 field and not near-unlimited dynamically loading fields like I am.


    How would I add in a fix to have the browser 'only' use the expansion if the user is using IE6 or IE7?

    I searched on the boards but couldn't find the solution to this problem. Thanks in advance!

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,698
    Mentioned
    101 Post(s)
    Tagged
    4 Thread(s)
    It seems like a IE-specific conditional comment may be your friend here.

    Using a downlevel-hidden one means that nothing gets to see the code inside the comment, unless it's IE and matches the condition.

    For example:

    Code:
    <!--[if (gte IE6) & (lte IE7)]>
    <script src="fixie6and7.js"></script>
    <![endif]-->
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript


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
  •