Sambhashanam
तकनीकी संभाषणम्
Navigation
  • Microsoft Technologies
  • Java Technologies
  • LAMP Technologies
  • Opensource
    • Microsoft Opensource
    • LAMP Opensource
    • Java Opensource
You are here: Home › Framework › Link on Image with hidden URL link
← Spring and Hibernate integration tutorial
Spring, JPA and Hibernate integration tutorial →

Link on Image with hidden URL link

August 4, 2013 | Filed under: Framework, LAMP Opensource, LAMP Technologies, Opensource and tagged with: javascript confirmation link on image, Link on Image with hidden URL link

Hello Friends,

Yesterday I was working on cakephp 1.3.6 based project and come to a point that “How to put an image in your views and also give link on that image. When the user brings mouse pointer on it, he must not be able to see the url. Also make a confirmation alert, once the user clicks on it.

It was a little bit complex at beginning but finally done. I think it may be useful for beginners so I decided to post it here.

The cakephp code.

<?php  echo $html->image('mail.png', array('onClick'=>'javascript:confirm(\'Are U sure to notify the user by mail?\')?location.href=\''._ROOT.'/admin/admins/notify_user/?act=notify&uId='.$userid.'\':\'\'','style'=>'cursor:pointer','title'=>'Notify the user by mail?','alt'=>'Notify the user by mail?'));?>

<?php  echo $html->image('mail.png', array('onClick'=>'javascript:confirm(\'Are U sure to notify the user by mail?\')?location.href=\''._ROOT.'/admin/admins/notify_user/?act=notify&uId='.$userid.'\':\'\'','style'=>'cursor:pointer','title'=>'Notify the user by mail?','alt'=>'Notify the user by mail?'));?>

In other way you want to write the code something like below, use the above code in cakephp.

<img alt="Notify the user by mail?" title="Notify the user by mail?" style="cursor:pointer" onclick="javascript:confirm('Are U sure to notify the user by mail?')?location.href='http://localhost/xyz/admin/admins/notify_user/?act=notify&uId=1':''" src="/ordertracker/Code/img/mail.png">

<img alt="Notify the user by mail?" title="Notify the user by mail?" style="cursor:pointer" onclick="javascript:confirm('Are U sure to notify the user by mail?')?location.href='http://localhost/xyz/admin/admins/notify_user/?act=notify&uId=1':''" src="/ordertracker/Code/img/mail.png">

The code is used for admin. Here admins_controller.php is the controller and admins/notify_user.ctp is the view in which this code is written.

I used this code in cakephp1.3.6 (an older version), if someone try to use it in a newer version, please try to write the code if some/any difference is there.

 

Share this:

  • Click to share on Twitter (Opens in new window)
  • Click to share on Facebook (Opens in new window)
  • Click to share on Google+ (Opens in new window)

Related

Did you like this article? Share it with your friends!

Tweet

Written by Sushil Pandey

Visit my Website
← Spring and Hibernate integration tutorial
Spring, JPA and Hibernate integration tutorial →

Authors

  • Dhananjay Jha
  • Manish Kumar
  • Sushil Pandey

Recent Comments

  • muhammad on Mail merge in java for Microsoft Word document – Part I
  • muhammad on Mail merge in java for Microsoft Word document – Part I
  • Dhananjay Jha on Mail merge in java for Microsoft Word document and convert to PDF without iText – Part II
  • Clyde Symonette on Mail merge in java for Microsoft Word document and convert to PDF without iText – Part II
  • Dhananjay Kumar Jha on Mail merge in java for Microsoft Word document and convert to PDF without iText – Part II

Tag Cloud

.net activiti activiti-spring activiti bpmn C# change sender mail id in wordpress class classloader Conver MS Word to PDF disable user wordpress dox4j glassfish http response compression java Java Mail Merge MS Word javascript confirmation link on image jax-ws on tomcat jax-ws webservice Jee JTS junit junit-spring Link on Image with hidden URL link load spring configuration load spring configuration xml junit maven maven build Merge MS Word using Java Merge Word Document using XdocReport OOPS oracle weblogic PDF conversion using docx4j php mail function sample activiti process with human task and service task sending mail with attachment spring-orm spring framework spring hibernate spring hibernate integration spring jpa spring jpa hibernate integration tomcat jax-ws web service wordpress wordpress sender email

Looking for old post?

© 2021 Sambhashanam