IE7 scores a point over FF2

If anyone's keeping score, I've found my first snippet of code which IE7 handles flawlessly but FF2 does not.

It's code for creating multiple recipient email fields with Javascript, such that creates as many as necessary and keeps the last field spare. Specifically this code is for deleting fields, which happens when you backspace or delete from a field which you've already emptied. This is modelled on how Thunderbird/Icedove's compose window behaves.

function autoCompleteContact(e)
    var event=(window.event)?window.event:e;
    var target=(window.event)?;

    //catch backspace or delete on an empty field as deleting the field
    if (target.value == '' && (e.keyCode == 8 || e.keyCode == 46))
        //don't delete the last field if it's empty
        if (target == recips[recips.length -1])

        //find the container element for all recipient input fields
        var recips_container=document.getElementById('recipients');
        if (!recips_container) return;

        //Javascript doesn't seem to provide an array remove()
        //so do effectively newrecips=recips.remove(target) manually
        var newrecips=new Array;
        for (var i=0; i < recips.length; i++) {
            var r = recips[i];
            if (r != target) {

        //Focus the last field


IE7 does it perfectly, FF2's layout breaks and it starts showing the contents of the INPUT elements in the wrong place.


Comments powered by Disqus