tags:

views:

1103

answers:

2

Well I am trying to convert an image into an button on a page of application done in CakePHP.This is the first issue.I can not use the image as a button.After that I want a Javascript which pops up a window of the action in it...!!!How can I do this thing...can any1 tell me how to do that..!!!

+1  A: 

For the image button I suggest you use this code:

<input type="image" src="<?php echo $html->image('image.gif'); ?> name="image" width="60" height="60">

To open the window with action inside, something like that:

<?php echo $html->link('yourlinkdescription', '#', array('onclick'=>"var openWin = window.open('".$html->url(array('action'=>'youraction')."', '_blank', 'toolbar=0,scrollbars=1,location=0,status=1,menubar=0,resizable=1,width=500,height=500');  return false;")); ?>
RioTera
A: 

Actually, the undocumented technique for using an image as a button is this:

<?php echo $form->end('image.gif'); ?>

Instead of the typical $form->end parameter which is the text for the button:

<?php echo $form->end('Submit'); ?>

Assuming image.gif is located at /app/webroot/img/image.gif, this will automatically create the button with that image.

adam