Solved

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

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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
HTML 5 Input Type Numeric 5 32
Div not showing up 6 32
Undefined variable with $_POST in PHP 5 38
Angular - difference between these 2 codes 3 15
This article discusses how to create an extensible mechanism for linked drop downs.
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

732 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