Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2

Thread: onclick

  1. #1
    New to the CF scene
    Join Date
    Jun 2008
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    onclick

    would it be possible to create another form inside the other one and set the target to self so it does not open a new window when the button is clicked. would the function be able to be duplicated or would the not work. if my code was like this would it work?

    Code:
    <input name="preview" type="image" value="preview"  onclick="changeAction(0)" src="admin/images/preview_btn.gif" alt="Preiview your Layout" align="left" />
            <br />
            <br />
            <input align="left" name="send2" type="image"  src="admin/images/test_btn.gif" alt="Send mailout" />
            <br />
            <br />
            
            <input align="left" name="send" type="image" onclick="changeAction(1)" src="admin/images/list_btn.gif" alt="Send mailout" />
            <br />
                <br /> 
    <form id="button" method="post" enctype="multipart/form-data" action="<?php echo $PHP_SELF; ?>" target="_blank">
                <input name="reset" type="image" onclick="broad.php" src="admin/images/reset_btn.gif" />
    </form>
    
    function changeAction(ins)
    {var form1 = document.getElementById('buttons');
    if(ins==0)
    form1.action = "broad_prev.php";
    if(ins==1)
    form1.action = "broad_send.php";
    form1.submit();
    }
    the above code for the change action would be for all the other button and this one below would be for the button which has been put in its own form

    Code:
    function changeAction(ins)
    {var form2 = document.getElementById('button');
    if(ins==0)
    form2.action = "window.location.reload()";
    form1.submit();
    }

  • #2
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    The problem starts wrong from the beginning: nesting forms inside other forms is illegal.

    As for the rest of your problem, I confess I understood almost nothing. Can you detail your aim, please?
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*


  •  

    Posting Permissions

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