1.11M Members

Change CSS

 
0
 

Hello,

What's the php code for changing css body background?.

If you press this button then, css body background changes. What to code it?

 
0
 

You wouldn't do this with PHP, you would do it with Javascript. You should check out the jQuery library. If you were to use jQuery, you would do it like this: $('body').css('background-color', 'blue');. You would need to be using the jQuery library though.

 
0
 

index.php

<script type="text/javascript">
$('#slideshow').cycle({ 
    fx:     'fade', 
    speed:   900, 
    timeout: 10000, 
    pager:  '#nav', 
    pagerAnchorBuilder: function(idx, slide) { 
        // return selector string for existing anchor 
        return '#nav li:eq(' + idx + ') a'; 
    } 
});
</script>


<div id="demos">
    <div id="slideshow" class="pics">
        <script>$('body').css('background-color', 'blue');</script>
        <script>$('body').css('background-color', 'red');</script>
        <script>$('body').css('background-image', 'url("../images/indonusa3.jpg")');</script>        
    </div>
    <ul id="nav">
        <li><a href="#"></a></li>
        <li><a href="#"></a></li>
        <li><a href="#"></a></li>   
    </ul>
</div>

The background navigation button keeps rolling, I can see a changing css text code on the left; yet, the background color is red with no images.

My goal is to have body background images changing along with the navigation button.

You
This article has been dead for over six months: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article