Solved

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

Posted on 2012-03-22
3
267 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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
How can I put a code without running my other code 4 18
getting id from database 5 24
Asp.net mvc 5 5 17
Bootstrap 3 icons 3 10
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
This article discusses four methods for overlaying images in a container on a web page
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.…
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…

707 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

12 Experts available now in Live!

Get 1:1 Help Now