473,396 Members | 1,982 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

window.form.submit

Hi All !

I have to code below - works great in IE and Opera, but does not work
at all in Firefox / Netscape. Any ideas?

The problem is that nothing happens when clicking printer friendly.

Thanks!
-sten

....
function onPrint()
{
window.printForm.submit();
}
....
<td>
<a href="#" onClick="onPrint(); return false;">printer friendly</a>
</td>
...
<form name="printForm" ction="/xasp?print=on" method=post>
...
<input type="hidden" name="TestField" value="dummy">
<input type="hidden" name="Date" value="">
...
</form>
...
Jul 23 '05 #1
2 10452
On 26 Oct 2004 09:16:27 -0700, Sten Larsson <st**********@yahoo.com> wrote:
I have to code below - works great in IE and Opera, but does not work
at all in Firefox / Netscape. Any ideas?
You can't access an element using its name or id as a global variable.
Opera only allows it to be compatible with IE. Reference the form properly:

document.forms['formName']
The problem is that nothing happens when clicking printer friendly.


Nothing will happen with Javascript disabled, either. If you want to make
something "printer friendly", write a print stylesheet that hides the
superfluous parts of the page. Don't maintain multiple versions of a page.

[snip]

Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 23 '05 #2


Sten Larsson wrote:
I have to code below - works great in IE and Opera, but does not work
at all in Firefox / Netscape. Any ideas?

The problem is that nothing happens when clicking printer friendly.
Check the JavaScript console of Firefox/Netscape and you will see what
happens, your script causes an error.
...
function onPrint()
{
window.printForm.submit();
You need
document.forms.printForm.submit();
<a href="#" onClick="onPrint(); return false;">printer friendly</a>
</td>
...
<form name="printForm" ction="/xasp?print=on" method=post>

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Matt | last post by:
Can form.submit() submit another form? In the following example, in page1.asp, it is fine to submit the current form: form1.submit(), and and I could see the value "Joe" in page2.asp. However, if I...
2
by: Halldór Ísak Gylfason | last post by:
In my application I have an iframe that is empty (and not visible) initially, however when a user presses a button a form is programmatically submitted and the target is set to the IFrame. I...
4
by: John Boy | last post by:
Hi, Can anyone help. This is really doing my nut in. 3 years ASP exp. and now doing .DOT which is a step in the wrong direction. Basically I am left with the code of a guy who has left. When I...
1
by: sudhaoncyberworld | last post by:
Hi all I am trying to submit the form and after form.submit line i am trying to open a url using window.open.... I found in some forum it is not possible to reach out the statement after the...
4
by: jwlum | last post by:
I have the following problem under Internet Explorer only: 1. User fills out form data (myform.php) and clicks a button that fires myFunction() 2. myFunction() spawns a "hello, world" popup page...
3
by: prodizy | last post by:
Hi, In Firefox, what's the best way of tracking the form submit? The following are two ways I tried, but they won't work if the form is submitted through JavaScript. Method 1: using the...
4
by: Gabriella | last post by:
Hi, I have a popup window that opens from a page on my website. This popup is a form with several fields. Upon submit button it redirects to a server side ASP page which writes all data to the...
1
by: gbezas | last post by:
Hi All, I have added an event handler to redirect form.submit() to a newSubmit() method that I have defined (which does some additional processing before submitting the form). Additionally I...
5
by: Curious89 | last post by:
There are 3 buttons on a web page. On clicking each button a same popup window (say window1) opens up. Now there is another button on this popup window (window1), which further opens up to another...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.