Solved

javascript in button that works in firefox but not in internet explorer

Posted on 2012-03-22
3
268 Views
Last Modified: 2012-04-04
Can anyone tell me why this code is working fine in Firefox but not in Internet Explorer? I need to be able to send a form to two different target pages in function if the users click on standard submit button or another button that changes the action of the form:


<form id="edit_Content" name="edit_Content" action="boto.asp" method="post">
<input name="name" type="text" />
somewhere in your form, you have a button:
<input type="button" value="Save" onclick="document.edit_Content.action='boto.asp';document.edit_Content.target = 'blank';document.edit_Content.submit();" />

</form>

Open in new window

0
Comment
Question by:starbase2
3 Comments
 
LVL 52

Assisted Solution

by:Scott Fell, EE MVE
Scott Fell,  EE MVE earned 167 total points
ID: 37751622
Why don't you just post the form to your asp page and use your server side scripting to post the data to the 2nd page?
0
 
LVL 13

Assisted Solution

by:ansudhindra
ansudhindra earned 166 total points
ID: 37751669
try this...

<script>
function doPost(){
document.edit_Content.action='boto.asp';
document.edit_Content.target = '_blank';
document.edit_Content.submit();
}
</script>

<form id="edit_Content" name="edit_Content" action="boto.asp" method="post">
<input name="name" type="text" />
somewhere in your form, you have a button:
<input type="button" value="Save" onclick="javascript:doPost()" />
</form>

Open in new window

0
 
LVL 9

Accepted Solution

by:
experts1 earned 167 total points
ID: 37752247
Try mod <input> button properties as below:

<input type="button" value="Save" onclick="document.edit_Content.setAttribute('action', 'boto.asp');document.edit_Content.setAttribute('target', 'blank');document.edit_Content.submit();" />

Open in new window

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Auto refresh part of an MVC5 View 7 53
Error in query expression 3 30
Check if Object property exists? 3 18
Put shading on half of picture 8 20
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

947 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now