DanUK
04-29-2003, 06:35 PM
Hi, how do you make a button to go to another page. I want an 'I Accept' and 'I Decline' buttons..one to go to a page, the other a different page. how do you do this pls
|
Click to See Complete Forum and Search --> : Button. DanUK 04-29-2003, 06:35 PM Hi, how do you make a button to go to another page. I want an 'I Accept' and 'I Decline' buttons..one to go to a page, the other a different page. how do you do this pls khalidali63 04-29-2003, 06:52 PM What you do is that in the onclcik event of the button add some javascript code,more likely a function,that performs redirectioning task when this button is clicked. Here is how this works.create 2 html input elements of type button <form name="form1" action=""> <input type="button" value="I Accept" <input type="button" value="I Decline" onclick="redirectTo('no')"/><br/>onclick="redirectTo('yes')"/><br/> </form> Now you need to create javascript code.In the above html code when a onclick event is triggered by pressing the "I Accept" or "I Decline" buttons,the browser looks for function names redirectTo(param) in the javascript tags such as below. <script type="text/javascript"> //define the function function redirectTo(parameter){ //now we know that when I Accepts i pressed the function will have parameter value = yes and no otherwise,we'll put a condition to validate just that. if(parameter=="yes"){ //now redirect to some page window.location.href="AgreementPage.html"; }else if (parameter=="no"){//this is reduntant,only to show you the working.. window.location.href="noAgreementPage.html"; } } </script> Hope this helps DanUK 04-29-2003, 06:55 PM Thanks! Yes that is brilliant, thanks. gosh it's a lot more easier with normal text-links :) web-eagle 04-29-2003, 07:04 PM The absolute simplest answer in pure HTML is to use a pair of links with graphic buttons. <a href="tld.com/accept.htm"><img src="accept.gif" width="100" height="25" border="0"></a> <a href="tld.com/decline.htm"><img src="decline.gif" width="100" height="25" border="0"></a> nkaisare 04-30-2003, 08:26 AM Of course if you insist on using buttons, <form action="true.html"> <div><input type="sumbit" name="I accept"></div> </form> <form action="false.html"> <div><input type="sumbit" name="I decline"></div> </form> webdeveloper.com
Copyright Internet.com Inc., All Rights Reserved. |