How to make onClick work with <a href=*.php?...>

From: Date: Tue, 15 Apr 2003 04:00:07 +0000
Subject: How to make onClick work with <a href=*.php?...>
Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-9263@lists.php.net to get a copy of this message
Hi folks, I want to change the background color in table cells. my onClick works if not calling PHP, but it does not work properly when using with <a href=*.php?...>. please see code below. The cells in the first two table rows with no php calls work fine. For the cells in the 3rd row, the onClick works (the cell turns from red to blue), but the color flips right back. I would like the color to stay blue. Would you please help? Thanks in advance, Sean 1. My PHP file: test.php ------------------------ <?php require("Smarty.class.php"); $smarty = new Smarty; $smarty->display("test.tpl"); ?> 2. My Smarty template file: test.tpl ------------------------------------ <html><head> <title>test</title> </head> <body> {literal} <style> TD.red { FONT-SIZE: 12px; COLOR: #000000; FONT-FAMILY: Arial,Helvetica; BACKGROUND-COLOR: #ff0000 } TD.blue { FONT-SIZE: 12px; COLOR: #000000; FONT-FAMILY: Arial,Helvetica; BACKGROUND-COLOR: #0000ff } </style> {/literal} <TABLE> <TR> <TD class=red onclick="this.className='blue'">One</TD> <TD class=red onclick="this.className='blue'">Two</TD> <TD class=red onclick="this.className='blue'">Buckle My Shoe</TD> </TR> <TR> <TD class=red onclick="this.className='blue'"><a href="#">Three</a> </TD> <TD class=red onclick="this.className='blue'"><a href="#">Four</a></TD> <TD class=red onclick="this.className='blue'"><a href="#">Shut the Door</a></TD> </TR> <TR> <TD class=red onclick="this.className='blue'"><a href="test.php?id=5">Five</a> </TD> <TD class=red onclick="this.className='blue'"><a href="test.php?id=6">Six</a></TD> <TD class=red onclick="this.className='blue'"><a href="test.php">Pick up Stix</a></TD> </TR> </TABLE> </body></html> __________________________________________________ Do you Yahoo!? The New Yahoo! Search - Faster. Easier. Bingo http://search.yahoo.com

« previous php.smarty.general (#9263) next »