Results 1 to 2 of 2
  1. #1
    yuchuang is offline Member
    Join Date
    Apr 2007
    Location
    Singapore
    Posts
    29
    Rep Power
    0

    Default creating an image button when using struts

    Below is one of the column of my table:

    Java Code:
    <display:column title="Action" class="tabletext3" headerClass="mainpanel2header">
          <logic:match value="1" name="researchPaper" property="docStatus">
                <img src="<c:out value='${imagesPath}'/>/icon_unpublish.gif" alt="Unpublish" border="0" width="13">
          </logic:match>
          <logic:notMatch value="1" name="researchPaper" property="docStatus"> 
                <img src="<c:out value='${imagesPath}'/>/icon_modify.gif" alt="Modify" border="0" width="13">
                <img src="<c:out value='${imagesPath}'/>/icon_publish.gif" alt="Publish" border="0" width="13">
                <img src="<c:out value='${imagesPath}'/>/icon_delete.gif" alt="Delete" border="0" width="13">
           </logic:notMatch>                                            
    </display:column>
    For those images, i want to make them into button so that when i click on them i will be able to call the javascript for a pop up window and when click ok, it will do the action that i wanted.

    Below is the javascript i used for the pop up window:

    Java Code:
    function confirmUnpublish()
      {
      var r=confirm("Click OK to confirm unpublish")
      if (r)
        {
            url=" ";
            window.location.href=url;
        }
      else
        {
            return false;
        }
      }
    Since i'm using struts, anyone knows how to do the image button?
    Last edited by yuchuang; 05-03-2007 at 09:25 AM.

  2. #2
    pegitha is offline Member
    Join Date
    Apr 2007
    Location
    Indiana
    Posts
    83
    Rep Power
    0

    Default

    the <img /> tag will allow you to have an onclick="" element in it. Use that to call the javascript.

Similar Threads

  1. Replies: 0
    Last Post: 01-08-2008, 05:29 PM
  2. how to display image in jsp page(Struts)
    By rama6262 in forum Advanced Java
    Replies: 1
    Last Post: 12-21-2007, 07:50 AM
  3. Struts - Solutions for creating Wizards
    By Larry in forum Web Frameworks
    Replies: 1
    Last Post: 07-11-2007, 05:59 PM
  4. Replies: 1
    Last Post: 06-07-2007, 05:06 AM

Posting Permissions

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