SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Hybrid View

  1. #1
    SitePoint Guru
    Join Date
    Nov 2004
    Location
    calif
    Posts
    733
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Adding Image to Button fails to send to correct link

    This works successfully:

    Code:
    <input type="button" name="search" value="Search Again" onclick="window.location.href='page.php?page=9';" style="margin:7px 0" style="padding:1px 2px 1px 2px">
    When I try to add an image, and test it, it doesn't take me to page.php?page=9 as before. Here's the added image code:

    Code:
    <input type="image" src="/images/button2.png" name="search" value="Search Again" onclick="window.location.href='page.php?page=9';" style="margin:7px 0" style="padding:1px 2px 1px 2px">
    If you could help me correct this, it would be greatly appreciated.

  2. #2
    Community Advisor silver trophybronze trophy
    dresden_phoenix's Avatar
    Join Date
    Jun 2008
    Location
    Madison, WI
    Posts
    2,791
    Mentioned
    34 Post(s)
    Tagged
    2 Thread(s)
    I am unable to duplicate the error, whats the URL that it sends you to?

    BTW, IMHO, this could easily be a link and NOT a button.

  3. #3
    SitePoint Guru
    Join Date
    Nov 2004
    Location
    calif
    Posts
    733
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for your reply.
    It doesn't send to a url, but to another page on the site age=9

    Please tell me what you mean by : IMHO, this could easily be a link and NOT a button
    not clear on your meaning

  4. #4
    Community Advisor silver trophybronze trophy
    dresden_phoenix's Avatar
    Join Date
    Jun 2008
    Location
    Madison, WI
    Posts
    2,791
    Mentioned
    34 Post(s)
    Tagged
    2 Thread(s)
    It doesn't send to a url, but to another page on the site page =9
    that's what a URL is, the address of any document on the web ( even within the same site)




    Well I could be wrong as I would need to know the CONTEXT of this button. Am assuming, since you are using a redirect, and you don't seem to have it pass any info, that you are not trying to resubmit the form ( which for search again, would be a bad idea!!!...see CONTEXT)

    The action you want the button to perform is to go to another page/or location of the page , this is the VERY DEFINITION of a link.

    So you could very well change the button to
    Code:
    <a href="page.php?page=9" class= "sa" >Search Again</a>
    and then add this to your CSS
    Code:
    .sa{
    margin:7px 0 ;
    padding:1px 2px ;
    height: 15px; /*height of your image*/
    width: 15px; /*width of your image*/
    overflow:hidden;
    display: inline-block;
    vertical-align:top;
    }
    .sa:before { content:url(/images/button2.png); display:block; }
    But this is a gray which ,again, depends on the context you have put your button in


Bookmarks

Posting Permissions

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