|
FireFox can be forgiving too but Safari isn't. Here's a nice little gem I
had to fix yesterday:
<SCRIPT LANGUAGE='JavaScript'>
function init()
{
document.advanceSearchForm.submit();
document.advanceSearchForm.OP.value = "addTerm";
document.advanceSearchForm.action = "someurl";
document.advanceSearchForm.submit();
}
</SCRIPT>
<form name='advanceSearchForm' method='post' action='someurl'>
</form>
Besides setting the action value twice and setting the value of OP via the
script instead of just setting it in the form, notice that there are two
submits. In IE and FireFox, the second one is called. In Safari, the first
one gets called.
Matt
-----Original Message-----
From: web400-bounces@xxxxxxxxxxxx [mailto:web400-bounces@xxxxxxxxxxxx] On
Behalf Of Walden H. Leverich
Sent: Friday, June 13, 2008 12:23 PM
To: Web Enabling the AS400 / iSeries
Subject: Re: [WEB400] javascript in IE or Mac
My guess is that I don't know javascriptnot.
too well and am doing something wrong that IE forgives but Firefox does
Bingo. IE is more forgiving about invalid (eg. Older) javascript, and
tries to figure out what you mean. Assuming "S1" is the ID on the form,
what you'll want is.
Var theForm = document.getElementById ('S1');
theForm.action= Action;
theForm.submit();
See http://www.w3schools.com/HTMLDOM/met_doc_getelementbyid.asp
Of couse, when you get tired of typing document.getElementById (and
remembering the correct casing) you will then "upgrade" to prototype
(prototypejs.org) and type:
Var theForm = $('S1');
--
Walden H Leverich III
Tech Software
(516) 627-3800 x3051
WaldenL@xxxxxxxxxxxxxxx
http://www.TechSoftInc.com
Quiquid latine dictum sit altum viditur.
(Whatever is said in Latin seems profound.)
-----Original Message-----
From: web400-bounces@xxxxxxxxxxxx [mailto:web400-bounces@xxxxxxxxxxxx]
On Behalf Of Larry Kleinman
Sent: Thursday, June 12, 2008 6:19 PM
To: Web Enabling the AS400 / iSeries
Subject: [WEB400] javascript in IE or Mac
I have a javascript function that allows me to submit a form. Here is
the
code:
<script language=JavaScript>
function SubmitForm(Action) {
document.S1.action = Action;
document.S1.submit ();
}
</script>
It is called from with a form with the following code:
<script language="javascript">
SubmitForm('https://payflowlink.paypal.com')
</script>
This runs fine in IE - the form data is submitted to the URL specified
in
the SubmitForm function.
When this runs in Firefox on a Mac, nothing happens (no error, but no
submit).
Anybody have an idea as to why? My guess is that I don't know
javascript
too well and am doing something wrong that IE forgives but Firefox does
not.
Larry Kleinman
Kleinman Associates, Inc.
212-949-6469
203-255-4100
--
This is the Web Enabling the AS400 / iSeries (WEB400) mailing list
To post a message email: WEB400@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/web400.
--
This is the Web Enabling the AS400 / iSeries (WEB400) mailing list
To post a message email: WEB400@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/web400.
--
This is the Web Enabling the AS400 / iSeries (WEB400) mailing list
To post a message email: WEB400@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/web400.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.