Results 1 to 6 of 6

Thread: "Click event"

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2005
    Posts
    103

    "Click event"

    I'm working on a chessgame right now. I have a table with black and white fields.... Over those fields there are images with transparent backgrounds.

    Now the problem.

    I want the backgroundcolor to change if someone clicks on the field. Is there a way to do that without reloading the page because i want the user to click at the 2nd field right after that?!

    Please help

    FES

  2. #2

    Thread Starter
    Lively Member
    Join Date
    Mar 2005
    Posts
    103

    Re: "Click event"

    In other words. I need to know how.

    -To change the backgroundcolor of the table without reloading the form

    -How to make a "click event" for a table.


    PLEASE HELP!

    FES

  3. #3
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    Re: "Click event"

    Moved to the HTML forum.
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  4. #4
    Lively Member {yak}'s Avatar
    Join Date
    Aug 2005
    Posts
    119

    Re: "Click event"

    You could change the background color when they click the cell:
    Code:
    <html>
    <head>
    <script type="text/javascript">
    function ChangeColor(elm, color1, color2)
    {
    	if(elm.style.background.indexOf(color2) != -1)
    	{
    		elm.style.background = color1;
    	}
    	else
    	{
    		elm.style.background = color2;
    	}
    }
    </script>
    </head>
    <body>
    <table>
    	<tr>
    		<td style="background-color: white;"  width="200" height="200" onclick="ChangeColor(this, 'black', 'white');">
    			cell
    		</td>
    	</tr>
    	<tr>
    		<td style="background-color: white;" width="200" height="200" onclick="ChangeColor(this, 'black', 'white');">
    		cell
    		</td>
    	</tr>
    </table>
    </body>
    </html>
    {yak}

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Mar 2005
    Posts
    103

    Re: "Click event"

    k. that should work
    thanks

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Mar 2005
    Posts
    103

    Re: "Click event"

    houston we got a problem:

    1. How do i change the value of a variable (php)
    2. Is it really necessary to use php AND javascript?? Is there no way to do it in vb??

    That's why i originally posted it in php.

    Plz help again.

    FES

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width