tags:

views:

320

answers:

2

code below working fine but not in IE6, IE7, below is the code is there any error please help

$(document).ready(function(){

    $(".backgroundElement").bind( "keyup change", function () {

        var color=$("#colorpickerField1").attr('value');
        var brnbackgroundurl=$("#brnbackgroundurl").attr('value');
        var scrollwithpage=$('#scrollwithpage').val();
        var bgposition=$('#bgposition').val();
        var bgrepeat=$('#bgrepeat').val();

        $("body").css({
           'background':'#'+color,
           'background':'url('+brnbackgroundurl+')'+bgrepeat+' '+ bgposition,
           'background-attachment':scrollwithpage
        });
    });

});
A: 

You do set the background twice.. Try using background-image for the second parameter.

Terw
Thanks Terw i tried you suggestion and it works but than i have to write backrgound-image other properties like position, repeat separatel, than i tried changing first paramter to background-color still not working :(
Yasir
in this case i have to change on multiple places user interface n lengthy code that is reapeating i have different div that have same html elements also thinking how i can make 1 function for all 4div but dont know how to pass all prop as paramaters. as we can in simple js click(1,2,3).
Yasir
+1  A: 
'url('+brnbackgroundurl+')'+bgrepeat

I think the error is in this part, you are missing a space.

Like this:

'url('+brnbackgroundurl+') '+bgrepeat

And to avoid more problems, just use the correct attribute order. Example from w3schools:

background: #00ff00 url('smiley.gif') no-repeat fixed center;
Ward Werbrouck