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 5 of 5
  1. #1
    Regular Coder
    Join Date
    Nov 2010
    Location
    Oregon
    Posts
    243
    Thanks
    23
    Thanked 10 Times in 10 Posts

    Add target to this form action

    Need help adding var target to this form action

    Would This be correct?

    var form = inp.form;
    form.target = "_self";


    Code:
    <html>
    </head>
    <script type="text/javascript">
    function formop(inp,op)
    {
        var form = inp.form;
    
        form.action = op + ".php";
        
        var temp = inp.id.split(",");
        form.id.value        = temp[0];
        form.FirstName.value = temp[1];
        form.LastName.value  = temp[2];
    }
    </script>
    </head>
    <body>
    <form method="post">
    <input type="hidden" name="id">
    <input type="hidden" name="FirstName">
    <input type="hidden" name="LastName">
    
    <input type='image' id='show,me,data' onclick=formop(this,'add');    src='static/icon16/add.jpg'>
    <input type='image' id='show,me,data' onclick=formop(this,'edit');   src='static/icon16/edit.jpg'>
    <input type='image' id='show,me,data' onclick=formop(this,'delete'); src='static/icon16/delete.jpg'>
    </form>
    </body>
    Last edited by DataTalk; 12-21-2010 at 04:31 PM.

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,947
    Thanks
    79
    Thanked 4,424 Times in 4,389 Posts
    Yes, that would work. But "_self" is the default, so there's no need to do that.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #3
    Regular Coder
    Join Date
    Nov 2010
    Location
    Oregon
    Posts
    243
    Thanks
    23
    Thanked 10 Times in 10 Posts
    Quote Originally Posted by Old Pedant View Post
    Yes, that would work. But "_self" is the default, so there's no need to do that.
    I understand that _self is default, I want to target an iframe
    action='add.php' target='editor'

    Just curious how you would to this?

  • #4
    Regular Coder
    Join Date
    Nov 2010
    Location
    Oregon
    Posts
    243
    Thanks
    23
    Thanked 10 Times in 10 Posts
    I understand that "_self" is default.
    I need to add a target to the above posted function

    I tried this but it did not work?
    Code:
    var form = inp.form;
    form.target = "editor";
    Last edited by DataTalk; 01-02-2011 at 08:13 PM.

  • #5
    Regular Coder
    Join Date
    Nov 2010
    Location
    Oregon
    Posts
    243
    Thanks
    23
    Thanked 10 Times in 10 Posts
    not sure if the target goes in the submit onclick side or in the function script
    Last edited by DataTalk; 01-01-2011 at 06:32 PM.


  •  

    Posting Permissions

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