Home > Scripts > Javascript post on form Submit open a new window

Javascript post on form Submit open a new window

1/ html form

form name="my_form"
Title: input type="text" name="txttitle"

Content: textarea name="txtcontent" textarea

input type="submit" name="btsubmit" value="Submit"
input type="button" name="btreview" value="Review"

 

2/ jquery or javascript function

//jquery
$('#btreview').click(function(){
with(document.my_form) {
method = 'POST';
action = 'php_post.php';
target = '_blank';
submit();
}
});

//javascript funtion
function review()
{
with(document.my_form) {
method = ‘POST’;
action = ‘php_post.php’;
target = ‘_blank’;
submit();
}
}

Nếu sử dụng javascript funtion nhớ khai báo gọi hàm tại tab button

input type="button" name="btreview" value="Review" onclick="/review();/"

do blog không cho post thẻ(tag) html nên các bạn nhớ ghi thẻ cho đúng <inp…, , ..etc

Advertisements
Categories: Scripts Tags:
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: