Jump to content

Button Link [Help!]


legendrock7

Recommended Posts

Hi, i found a code that you have to check the box to order to click on the button to proceed to the other page but i want on that submit button to have a link after it's checked by the box.

 

my code:

<form name="frm">
<table style="border:solid green 1px">
<tr><td align=center><input type="checkbox" name="chk" onclick="apply()"></td></tr>I agree Terms and Conditions
<tr><td align=center><input type="button" name="sub" value="submit" disabled></td></tr>
<tr><td align=center>&copy<a href="http://www.hscripts.com" style="color:#3D366F;text-decoration:none;cursor:pointer;font-size:13px">hscripts.com</a></td></tr></table>
</form>

[color=#000000][size=3]<script type="text/javascript">[/size][/color]


function apply()
{
 document.frm.sub.disabled=true;
 if(document.frm.chk.checked==true)
 {
   document.frm.sub.disabled=false;
 }
 if(document.frm.chk.checked==false)
 {
   document.frm.sub.enabled=false;
 }
}
</script> 

 

 

thanks!

Link to comment
https://forums.phpfreaks.com/topic/271465-button-link-help/
Share on other sites

<form name="frm">
<table style="border:solid green 1px">
<tr><td align=center><input type="checkbox" name="chk" onclick="javascript:apply();"></td></tr>I agree Terms and Conditions
<tr><td align=center><input type="button" name="sub" onclick="javascript:callfuction();" value="submit" disabled></td></tr>
<tr><td align=center>&copy<a href="http://www.hscripts.com" style="color:#3D366F;text-decoration:none;cursor:pointer;font-size:13px">hscripts.com</a></td></tr></table>
</form>




<script type="text/javascript">
function callfunction()
{
var _width = screen.width;
var _height = screen.height;
var win = window.open("somepage.php", "_top", "top=0, left=0, screenX=0, screenY=0, width="+_width+",height="+_height+",toolbars=0");
}


function apply()
{
document.frm.sub.disabled=true;
if(document.frm.chk.checked==true)
{
document.frm.sub.disabled=false;
}
if(document.frm.chk.checked==false)
{
document.frm.sub.enabled=false;
}
}
</script>

Link to comment
https://forums.phpfreaks.com/topic/271465-button-link-help/#findComment-1396803
Share on other sites

Here's a Demo Page: http://xaotique.no-ip.org/tmp/25/

 

<script type="text/javascript">
   // Allow Page To Load
   window.addEventListener("load", function()
   {
       // Set Defaults
       window.document.frm.chk.checked  = false;
       window.document.frm.sub.disabled = true;

       // Click Event (Tick)
       window.document.frm.chk.addEventListener("click", function()
       {
           // Enable/Disable Button
           window.document.frm.sub.disabled = !window.document.frm.chk.checked;
       }, false);

       // Click Event (Button)
       window.document.frm.sub.addEventListener("click", function()
       {
           // Go To Page
           window.location = "http://example.com";
       }, false);
   }, false);
</script>

 

<form name="frm">
   <table style="border:solid green 1px">
       <tr>
           <td align=center>
               <input type="checkbox" name="chk" onclick="apply()" >
           </td>
       </tr>I agree Terms and Conditions
       <tr>
           <td align=center>
               <input type="button" name="sub" value="submit">
           </td>
       </tr>
       <tr>
           <td align=center>
               &copy<a href="http://www.hscripts.com" style="color:#3D366F;text-decoration:none;cursor:pointer;font-size:13px">hscripts.com</a>
           </td>
       </tr>
   </table>
</form>

Link to comment
https://forums.phpfreaks.com/topic/271465-button-link-help/#findComment-1398111
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.