Solved

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

Posted on 2012-03-22
3
273 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 53

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

What Is Transaction Monitoring and who needs it?

Synthetic Transaction Monitoring that you need for the day to day, which ensures your business website keeps running optimally, and that there is no downtime to impact your customer experience.

Question has a verified solution.

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

This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
Originally, this post was published on Monitis Blog, you can check it here . Websites are getting bigger and more complicated by the day. Video, images and custom fonts are all great for showcasing your product or service. But the price to pay in…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

724 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