SitePoint Sponsor

User Tag List

Results 1 to 13 of 13
  1. #1
    SitePoint Enthusiast
    Join Date
    Apr 2002
    Posts
    43
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Linking a button?

    I'm using Studio.Net to program a site (for a mortgage company). I was wanting to have two clickable buttons on my disclosure/disclaimer page. One agreeing, one declining. I have been able to do it with hyperlinks (that's too easy), but I really wnated to have clickable buttons to make it look more professional. Does anyone know what code I'd use to do this as I've run through all of the .net references and was unable to find anything. Thanks!

    Sorry I learned to program HTML through manuals so i have several massive holes in my knowledge.

  2. #2
    Bimbo With A Brain! silver trophy Saz's Avatar
    Join Date
    Mar 2001
    Location
    Kent, United Kingdom
    Posts
    5,275
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You link an image like this:
    Code:
    <a href="page_you_are_linking_to.html"><img border="0" src="your_image.gif" width="x" height="y"></a>
    Where 'x' = the image width and 'y' = the image height.
    Saz: Naturally Blonde, Naturally Dizzy!
    No longer Editor of the Community Crier.

    Don't mind me, I'm having a BLONDE moment!

  3. #3
    SitePoint Enthusiast
    Join Date
    Apr 2002
    Posts
    43
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    In my Visual Studio under my toolbox i have a object titled "Button" that can be dragged out onto the HTML document. I was trying to use that as my accept and decline buttons and I'm thinking it might actually be VBScript but I'm not sure. This is the entire code for just two buttons the ones i want to link. what do i need to do from here?
    </head>
    <body>

    <P align="center">
    <INPUT id="Decline" type="button" value="I do not agree to the above conditions" name="Declined"></P>

    <P align="center">
    <INPUT id="Accept" type="button" value="I have read and agree with the above conditions" name="Accept"></P>

    </body>
    </html>

    Thanks!

  4. #4
    Bimbo With A Brain! silver trophy Saz's Avatar
    Join Date
    Mar 2001
    Location
    Kent, United Kingdom
    Posts
    5,275
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Can you explain exactly what you want to happen when a visitor clicks on one of these buttons?
    Saz: Naturally Blonde, Naturally Dizzy!
    No longer Editor of the Community Crier.

    Don't mind me, I'm having a BLONDE moment!

  5. #5
    SitePoint Member
    Join Date
    Apr 2002
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    why not add "onClick" to send the user to the desired location?

  6. #6
    SitePoint Enthusiast
    Join Date
    Apr 2002
    Posts
    43
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That's exactly what I want to do. Have an onclick event to jump to one link or the other. I'm just not sure of how to set it up. sorry I'm a newbie.

  7. #7
    Bimbo With A Brain! silver trophy Saz's Avatar
    Join Date
    Mar 2001
    Location
    Kent, United Kingdom
    Posts
    5,275
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    For the life of me, I cannot set up the 'onclick' to link to another page.

    I do have an alternate solution though. I'm assuming that you want the visitor to be directed to different pages depending on which button they click on, and if that's the case, all you need to do is create two graphics (one for accept and one for decline) and use the line of code I mentioned above. Like this:
    Code:
    <body>
    <center>
    <table border="0" width="300" cellspacing="0" cellpadding="0">
    <tr>
    <td width="150" align="center">
    <a href="accept.html"><img border="0" src="images/agree.gif"></a></td>
    <td width="150" align="center">
    <a href="decline.html"><img border="0" src="images/disagree.gif"></a></td>
    </tr>
    </table>
    </center>
    </body>
    This was put together very quickly, so it's rather crude, but to see it working, click here.
    Saz: Naturally Blonde, Naturally Dizzy!
    No longer Editor of the Community Crier.

    Don't mind me, I'm having a BLONDE moment!

  8. #8
    SitePoint Guru sowen's Avatar
    Join Date
    Feb 2001
    Location
    Stockport, UK
    Posts
    729
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you are using .net you could do it like this;

    In you html
    Code:
    <asp:button id="accept" runat="server" text="Accept"></asp:button>
    <asp:button id="decline" runat="server" text="Decline"></asp:button>
    then in your codebehind or <script> block; (sorry, this is in C# not VB)
    Code:
    private void accept_Click(object sender, system.EventArgs e)
    {
    Response.Redirect(accept.aspx);
    }
    
    private void decline_Click(object sender, system.EventArgs e)
    {
    Response.Redirect(decline.aspx);
    }
    I'm new to this to but that should work

    Simon

  9. #9
    SitePoint Member
    Join Date
    Apr 2002
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That's exactly what I want to do. Have an onclick event to jump to one link or the other. I'm just not sure of how to set it up. sorry I'm a newbie.
    okay, I can help you out. I will post back later...I am kinda busy at the moment.

    hurley

  10. #10
    SitePoint Member
    Join Date
    Apr 2002
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    </head>
    <body>

    <P align="center">
    <INPUT TYPE="button" value="I do not agree to the above conditions" onClick="window.location='http://www.someplace.com';">
    </P>

    <P align="center">
    <INPUT TYPE="button" value="I have read and agree with the above conditions" onClick="window.location='www.someplace.com';">
    </P>

    </body>
    </html>

    Just input your url for 'www.someplace.com' to send the user to the page you desire.

    You could also create a function in the <head> section to call the window.location property, but I don't think it is necessary for just two buttons.

    good luck
    hurley

  11. #11
    SitePoint Enthusiast
    Join Date
    Apr 2002
    Posts
    43
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks that did the job perfectly!

  12. #12
    SitePoint Enthusiast
    Join Date
    Apr 2002
    Posts
    43
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    One problem, the base that I had set at the top of this page, is no longer functioning. How do I get it to rely on the base and not have to tyope in a full web address (This is a problem now as the site is in development, on my hard drive and not up on the domain server yet.)

  13. #13
    SitePoint Enthusiast
    Join Date
    Apr 2002
    Posts
    43
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Also how do I set up a target='_top' in this situation?


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
  •