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
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>

Edited by Mancent
Link to comment
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>

Edited by Xaotique
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.