Results 1 to 6 of 6

Thread: button value to hyperlink?, help

  1. #1
    Join Date
    Mar 2007
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Cool button value to hyperlink?, help

    I have a logout button which this code:
    Code:
    <input name=Button type=button class=button tabIndex=5 onClick="location.href='?logout';" value="Logout" on>
    I need to change it to an html link without a button image to fit this sequence:
    Code:
    <a href="http://mysite.com/logout" title="Logout">Logout</a>

    So basically I need the link to be changed from a button to a hyperlink so I can put it as a header
    Last edited by camel101; 04-24-2007 at 03:56 AM.

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    The location that takes you to is [currentpage.ext]?logout ...just link to that.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #3
    Join Date
    Mar 2007
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I did try that and it did not work.

    To make it more clear, i want to change a submit button to a hyperlink. Is this even possible?

    Thanks

  4. #4
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Ah, you could make the link go to the same place but the submit button cannot be accessed by a link... kinda.

    There are two workarounds--
    1. Style the button to act like a link. Simple enough. Not sure on the CSS, but it's possible.
    2. Use javascript--
    <a href="javascript:onClick(document.formname.submit());">link</a>
    I'm not sure on the specific code... but I think that may work. Basically, you just need to do the javascript function make it submit, rather than going to an actual link. But it will require javascript be enabled.
    Last edited by jscheuer1; 04-25-2007 at 01:39 AM. Reason: disable smilies
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  5. #5
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    The literal translation of this:

    Code:
    <input name=Button type=button class=button tabIndex=5 onClick="location.href='?logout';" value="Logout" on>
    to a link would be:

    HTML Code:
    <a href="?logout">Logout</a>
    Clicking on a link like that will reload the page and add the query string:

    ?logout

    to the address in the address bar. If the page is a server side page (.asp, .php etc.), and is written to detect that query string and act on it, it will do so. Also, if it has javascript on it to detect that string and act on it, and the user has javascript enabled - it will happen that way too.

    However, ?logout isn't your usual type of query string so, there may be problems because of that
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  6. #6
    Join Date
    Mar 2007
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    It was a server-side script and possibly the CSS that was messing things around but now I have it all fixed

    Thanks for the help Mods

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
  •