CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    May 2002
    Posts
    72

    Button Onclick does not work!

    Hi, everyone!

    Please look at the following codes,

    --------
    <html>
    <head>
    </head>

    <form>
    <input type="button" value="button" name="B1" OnClick="b.html">
    </form>

    </Html>
    --------

    I want to guide user to view a new page (b.html) when
    clicking button "B1". But the above codes do not work.
    How to resolve the trouble?

    Cheers,
    George

  2. #2
    Join Date
    Sep 1999
    Location
    Leeds U.K. (Proud to be Sheffield Born)
    Posts
    202

    Try this...

    <form>
    <input type="button" value="button" name="B1" OnClick="window.navigate(b.html);">
    </form>

  3. #3
    Join Date
    Aug 2002
    Location
    Reykjavik, Iceland
    Posts
    201
    The window.navigate() method will not work on Netscape, so if your user base includes Netscape users then you should use the window.location property instead:

    <form>
    <input type="button" value="button" name="B1" OnClick="window.location='b.html';">
    </form>

  4. #4
    Join Date
    Sep 1999
    Location
    Leeds U.K. (Proud to be Sheffield Born)
    Posts
    202

    Netscape

    Apologies. In my line of work, it's too easy to forget about Netscape - or indeed any other non-microsoft browser. Thanks to Websmith for putting me right.

  5. #5
    Join Date
    Jan 2002
    Location
    Helsinki, Finland
    Posts
    99
    valid XHTML :
    Code:
    <form action="">
    	<input type="button" value="Google" onclick="location.href = 'http://www.google.com';" />
    </form>
    Last edited by Zvona; September 27th, 2002 at 12:44 PM.
    Zvona - First aid for client-side web design

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured