What are the pros and cons using javascript in our form?

Posted by justjoe on Stack Overflow See other posts from Stack Overflow or by justjoe
Published on 2010-04-04T05:41:46Z Indexed on 2010/04/04 5:53 UTC
Read the original article Hit count: 467

Filed under:
|
|
|
|

I got this code in my submit form

<form id="myform" action='hello.php' method='GET'>
    <input type="button" name="newWin" onclick="frmSubmitSameWindows();">
    <input type="button" name="SameWin" onclick="frmSubmitNewWindows();">
<form>

Then use some js functions in the head;

function frmSubmitSameWindows() {
form.target = '';
form.submit();
}


function frmSubmitNewWindows() {
form.target = '_blank';
form.submit();
}

What is the pro and cons when we use javascript event function such as frmSubmitSameWin() and frmSubmitNewWin() in our form ? as far as i concern, this is the best solution when we need a way to submit things. Is there other preference ? the better way then the way i got now ?

© Stack Overflow or respective owner

Related posts about php

Related posts about php-basic