View Full Version : Add target to this form action

12-21-2010, 03:20 PM
Need help adding var target to this form action

Would This be correct?

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

<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];
<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'>

Old Pedant
12-21-2010, 08:12 PM
Yes, that would work. But "_self" is the default, so there's no need to do that.

12-25-2010, 07:32 AM
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?

01-01-2011, 07:26 PM
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?

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

01-01-2011, 07:29 PM
not sure if the target goes in the submit onclick side or in the function script