[IE BUG] onfocus + margin

Pagina: 1
Acties:

  • X-Lars
  • Registratie: Januari 2004
  • Niet online

X-Lars

Just GoT it.

Topicstarter
Hello,

Volgens mij heb ik hier een bug te pakken en ik kan er niets over vinden. In IE verspringen de input-fields verticaal als de focus er op komt. Zonder de margin-bottom gebeurt dit natuurlijk niet, maar ik moet toch margins kunnen plaatsen? Deze margin zetten in de input.sfFocus maakt ook niets uit.

HTML:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
    <head>
        <title>onfocus bug</title>
              
        <style type="text/css">
        input {
            display:block;
            margin-bottom:8px;
        }
        input:focus {
            background-color:#EEE;
        }
        </style>
        
        <!--[if IE]>
            <style type="text/css">
            input.sfFocus {
                background-color:#EEE;
            }
            </style>

            <script type="text/javascript">
                function ieFocus() {
                    sfEls = document.getElementsByTagName('INPUT');
                    for (var i=0; i<sfEls.length; i++) {
                        sfEls[i].onfocus=function() {
                            this.className+=" sfFocus";
                        }
                        sfEls[i].onblur=function() {
                            this.className=this.className.replace(new RegExp(" sfFocus\\b"), "");
                        }
                    }
                }
                window.onload = ieFocus;
            </script>
        <![endif]-->
    </head>
    <body>
        <form id="contact">
            <fieldset>
                <label for="name">Name:</label><input type="text" name="name" value="">
                <label for="email">Email:</label><input type="text" name="email" value="">
                <label for="phone">Phone:</label><input type="text" name="phone" value="">
            </fieldset>
        </form>
    </body>
</html>

  • crisp
  • Registratie: Februari 2000
  • Laatst online: 18:43

crisp

Devver

Pixelated

Ja, dat zal best een bug zijn. IE kent honderden bugs, dus ik kijk allang nergens meer van op :P

Intentionally left blank