please please help me in this PHP program problem.. please its urgent..please?

i created a div and set a background image in that div by using style tag and in that div i created a form… so i want to create a button with onclick event… so that whenever that button is clicked the background image of the div should be changed…so please please help me how to do this?

<div id="div3" style="background-image:url(../images/re… border:double; border-color:#666666; z-index:1; width:230px; height:350px;position:absolute; left:45px; top:15px;">
<form name="chatting1" action="chat1.php" method="post">

<textarea name="chat1" cols="25" rows="3"></textarea>
<br>
<input type="submit" name="submit" value="REPLY">

now create a button which changes the background image of the div whenever it is clicked…

<head>
<script>
bkgnew = new Image(); // preload the image!
bkgnew.src = "newimage";
function change_bkg()
{
var x = document.getElementById(‘div3′);
x.style.background-image = "url(newimage)";
}
</script>
</head>
<body>
<div ….
<form …
<input … onmousedown="change_bkg(); return false;" />

Preload the image with the first two lines of the script.
Use "onmousedown" instead of "onclick": When you click, the form will be sent, and you will not have the time to see the change!
Get the free script "mini Chat" at http://www.web2coders.com

3 Responses to “please please help me in this PHP program problem.. please its urgent..please?”

  • German says:

    <div id="div3" style="background-image:url(../images/reply.jpg border:double; border-color:#666666; z-index:1; width:230px; height:350px;position:absolute; left:45px; top:15px;">
    <form name="chatting1" action="chat1.php" method="post">

    <textarea name="chat1" cols="25" rows="3"></textarea>
    <br>
    <input type="submit" name="submit" value="REPLY" >
    </form>
    </div>
    References :

  • Greybox says:

    use javascript
    References :

  • just "JR" says:

    <head>
    <script>
    bkgnew = new Image(); // preload the image!
    bkgnew.src = "newimage";
    function change_bkg()
    {
    var x = document.getElementById(‘div3′);
    x.style.background-image = "url(newimage)";
    }
    </script>
    </head>
    <body>
    <div ….
    <form …
    <input … onmousedown="change_bkg(); return false;" />

    Preload the image with the first two lines of the script.
    Use "onmousedown" instead of "onclick": When you click, the form will be sent, and you will not have the time to see the change!
    Get the free script "mini Chat" at http://www.web2coders.com
    References :
    more php scripts at http://www.web2coders.com

Leave a Reply