Jump to content


Photo

Grouped radio button with image which has javascript for onclick


  • Please log in to reply
No replies to this topic

#1 shocker-z

shocker-z
  • Members
  • PipPipPip
  • Advanced Member
  • 864 posts
  • LocationNottingham

Posted 04 April 2006 - 09:43 AM

I have a problem with my grouped radio button when i click the image it doesn't selct the radio button too.. it does highlight the radio button so i know it's partly correct but i think it may be the javascript for displaying the main image that is stopping it from being selected..

anyone?

see here [a href=\"http://blucode.sytes.net/ukchat/index.php\" target=\"_blank\"]http://blucode.sytes.net/ukchat/index.php[/a] login details
Username: shocker-z
Password: [blank]
by blank i mean totaly blank! :)

Here is all the code i'm using

<? 
if ($_SESSION['logged_in']) {
?>
<script language="javascript">
function switch1(div) {
if (document.getElementById('1')) {
var option=['1','2','3'];
for(var i=0; i<option.length; i++) 
{ obj=document.getElementById(option[i]);
obj.style.display=(option[i]==div)? "block" : "none"; }
}
}
//
function switchImg(i){
document.images["wine"].src = i;
}
</script>


<table width="450" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="300" align="left" valign="top"><p class="fright"><img src="profiles/nopic.gif" id="wine" height="300" width="300" alt="" /></p></td>
    <td width="150" valign="top"><div class="fright"></div>
      <div align="center">
        <?php
$img_query=mysql_query("SELECT username,ID,description FROM images WHERE username='$session_username' LIMIT 3");
$i=0;
while ($img=mysql_fetch_array($img_query)) {
$i++;
if ($img) {
$id=$img['ID'];
$cat2=$cat.'/';
?>
      </div>
      <hr align="center" />
      <div align="center">
        <input type="radio" name="del_picture" id="<?php echo $id; ?>" accesskey="<?php echo $id; ?>" checked> <label for="<?php echo $id; ?>">pic <?php echo $id; ?>
        <img src="<?php echo($cat2.'thumbs.php?id='.$id); ?>" onclick="switchImg('<?php echo($cat2.'view.php?id='.$id); ?>')" checked="checked" /></label>
      </div>
      <hr align="center" />
      <div align="center">
  <?php
} else { 
echo('no image');
}
$i++;
}
?>
  </div>
    </div></td>
  </tr>
</table>
<p>
  <label></label>
  <?php
} else {
        if (!$_SESSION['logged_in']) {
            echo("You are not logged in!");
        }
}?>
</p>


Regards
Liam
www: www.ukchat.ws | irc: irc.ukchat.ws chan: #blufudge




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users