473,809 Members | 2,758 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

javascript working on mozilla firefox but not on IE 6

41 New Member
Hi,

I have the following script

Expand|Select|Wrap|Line Numbers
  1. function submitForm1()
  2. {
  3.    document.forms[0].action="SearchRecords";
  4.    document.forms[0].submit();
  5. }
[HTML]<select name="l" onchange="submi tForm1();">[/HTML]

This script is working on firefox but not in IE6.
Can anybody tell me why this is happening and the alternative solution to perform the same function.

Thanks
Oct 29 '07
26 3380
acoder
16,027 Recognized Expert Moderator MVP
As I told you before, you have to change the name of the submit button. IE is very easily confused!

On line 89, you have:[HTML]<input type=submit name=action value="Submit" onclick="submit Form2();">[/HTML] Change "action" to "action1" or some other name that is not the name of a method or attribute.
Oct 31 '07 #21
itgaurav198
41 New Member
As I told you before, you have to change the name of the submit button. IE is very easily confused!

On line 89, you have:[HTML]<input type=submit name=action value="Submit" onclick="submit Form2();">[/HTML] Change "action" to "action1" or some other name that is not the name of a method or attribute.
Hi,
I have tried it but still its not working

Thanks
Oct 31 '07 #22
acoder
16,027 Recognized Expert Moderator MVP
Hi,
I have tried it but still its not working

Thanks
So what happens now? Any errors? Can you also post your revised code?
Oct 31 '07 #23
itgaurav198
41 New Member
So what happens now? Any errors? Can you also post your revised code?
Hi,

Revised code as below

Expand|Select|Wrap|Line Numbers
  1. <%@ page import="java.util.ArrayList"%>
  2. <%@ page import="javax.servlet.*"%>
  3. <%@ page import="javax.servlet.http.*"%>
  4.  
  5. <html>
  6. <head>
  7. <title> Form </title>
  8. <script language="javascript" type="text/javascript">
  9.  
  10. function submitForm1()
  11. {
  12.  
  13.    document.forms[0].action="SearchRecords";
  14.    alert("fghfhfhf");
  15.  
  16.    document.forms[0].submit();
  17. function submitForm2()
  18. {
  19. document.forms[0].action="Search";
  20. document.forms[0].submit();
  21. }
  22. </script>
  23.  
  24. <%
  25. ArrayList al=(ArrayList)session.getAttribute("str_");
  26. %>
  27.  
  28.  
  29. </head>
  30.  
  31.  
  32.  
  33. <body bgcolor="fuschia">
  34.  
  35.  
  36.  
  37. <center>
  38.  
  39.     <font size=7 color="red"> Please Enter the following information: </font>
  40.        <form name="form1" method="POST">
  41.  
  42.            <table cellspacing="2" cellpadding="2" border="0">
  43.             <tr>
  44.         <td><input type="hidden" name="role" id="role"></td>
  45.             </tr>
  46.  
  47.         <tr>
  48.         <td align="left"><font size=5>Last Name</font></td>
  49.         <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type=text name="sn" value="<%=request.getAttribute("lname") %>"></td>
  50.         </tr>
  51.  
  52.         <tr>
  53.         <td align="left"><font size=5>FullName</font></td>
  54.         <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type=text name="cn" value="<%=request.getAttribute("fname")%>"><td>
  55.         </tr>
  56.  
  57.         <tr>
  58.         <td align="left"><font size=5>Location</font></td>
  59.         <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  60.         <select name="l" onchange="submitForm1();">
  61.         <%if(request.getAttribute("location")!=null)%>
  62.         <Option value="<%=request.getAttribute("location")%>><%=request.getAttribute("location")%></Option>
  63.         <Option value="Chandigarh">Chandigarh</Option>
  64.         <Option value="Pune">Pune</Option>
  65.         <Option value="Banglore">Banglore</Option>
  66.         </select>        </td>
  67.         </tr>
  68.  
  69.         <tr>
  70.         <td align="left"><font size=5>Role</font></td>
  71.         <%try{%>
  72.         <TD>
  73.             <select name="erRoles" id="erRoles"> 
  74.             <option>- - - - - - -</option>
  75.             <%for(int i=0;i<al.size();i++){%>
  76.             <Option value="<%=al.get(i).toString()%>"><%=al.get(i).toString()%></Option>
  77.             <%}%>
  78.             </select>
  79.             </TD>      
  80.             <%}
  81.             catch(Exception e)
  82.             {
  83.               e.printStackTrace();
  84.              }%>
  85.             </tr> 
  86.  
  87.             <tr>
  88.             <td align="right"><input type=submit name=action value="Submit" onclick="submitForm2();"></td>
  89.             <td align="left">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type=reset name="submitButton" value="Reset"></td>
  90.             </tr>
  91.         </table>
  92.  
  93.     </form>
  94. </center>
  95. </body>
  96. </html>
The same situation ie when i use alert box before setting document.forms[0].action="Search Records" it shows the alert bax on onchange event but don't submit the code but when i place alert before document.forms[0].action="Search Records" neither it shows alert box nor it submits the form.

Even in both the cases it shows a warning (that browser shows when page loads) and the details are

Line: 12
Char: 4
Error: Object doesn't support this property or Method
Code: 0
URL: ............... ............


Thanks
Oct 31 '07 #24
acoder
16,027 Recognized Expert Moderator MVP
You've not actually made the change.

Change line 89 to:
[HTML]<td align="right">< input type=submit name="action1" value="Submit" onclick="submit Form2();"></td>[/HTML]
Oct 31 '07 #25
itgaurav198
41 New Member
You've not actually made the change.

Change line 89 to:
[HTML]<td align="right">< input type=submit name="action1" value="Submit" onclick="submit Form2();"></td>[/HTML]
Hi,
Sorry, actually i have changed the one button code and not the other now this is working fine.

But still I am not clear why the same (wrong) code was working fine on Firefox.
Can you tell me the reason or some link where i can find out these differences between firefox and IE.
Thanks
Thanks a lot
Oct 31 '07 #26
acoder
16,027 Recognized Expert Moderator MVP
The situation is same as described in above post.
Now you've renamed the reset button to "action". Use a different name.
Oct 31 '07 #27

Sign in to post your reply or Sign up for a free account.

Similar topics

8
3681
by: chrisdude911 | last post by:
how do i add video into a javascript web page with my own custom buttons?
7
9623
by: Coder | last post by:
Hi I have the following code in java script, it is not giving proper output in FIREFOX but running fine in IE... can anybody help me out to make this run in FIREFOX . <script language="JavaScript"> var cntlName; var eleTarget = document.getElementById('hiding'); function showOrHide(){
0
9721
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10635
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10376
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10378
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10115
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9198
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7653
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5550
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3861
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.