473,785 Members | 2,421 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

onChange ComboBox javascripts not working on Firefox but works fine on IE

4 New Member
Hi everybody,
Im trying to use that piece of javascripts for 2 combo box in my web site but its nt working on Firefox but it works well in IE 6.0 :S
Can someone please help me in solving this problem.
I included the js functions.
The first ComboBox is when the user select an option the URL must may be a pop up and the second ComboBox needs to open the URL within the page itself.
Both are using the onChange() function.

Thanks for a quick reply or solutions ;)

The codes are as follows:


=> included in the <head>

Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">
  2. function MM_goToURL() { //v3.0
  3.   var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  4.   for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
  5. }
  6. function MM_openBrWindow(theURL,winName,features) { //v2.0
  7.   if (theURL != "") {
  8.   window.open(theURL,winName,features);
  9.   }
  10. }
  11. function MM_swapImgRestore() { //v3.0
  12.   var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
  13. }
  14. </script>
  15.  
  16. ------------------
  17.  
  18. <body>....
  19.  
  20. <select name="select" class="booking" onChange="MM_openBrWindow(this.options(this.selectedIndex).value,'bookwindow','')">
  21.               <option selected="selected">--------</option>
  22.               <option value="http://www.google.com">1</option>
  23.               <option value="http://www.google.com">2</option>
  24.               <option value="http://www.google.com">3</option>
  25.               <option value="http://www.google.com">4</option>
  26.               <option value="http://www.google.com">5</option>
  27.             </select>
  28.  
  29. ------------- 
  30.  
  31.  
  32. <select name="select2" class="booking" onChange="MM_goToURL('parent',this.options(this.selectedIndex).value);return document.MM_returnValue">
  33.               <option selected="selected" value="#">--------</option>
  34.               <option value="http://www.google.com">1</option>
  35.               <option value="http://www.google.com">2</option>
  36.               <option value="http://www.google.com">3</option>
  37.               <option value="http://www.google.com">4</option>
  38.               <option value="http://www.google.com">5</option>
  39.             </select>
Jul 18 '08 #1
6 3847
acoder
16,027 Recognized Expert Moderator MVP
First mistake: testing in IE first.

IE is sometimes lax on syntax. options is an array, so you need square brackets [], not round brackets/parentheses (), i.e. options[...]

Please enclose your code using code tags.
Jul 18 '08 #2
shailen21
4 New Member
First mistake: testing in IE first.

IE is sometimes lax on syntax. options is an array, so you need square brackets [], not round brackets/parentheses (), i.e. options[...]

Please enclose your code using code tags.

Ooops sorry about the codes...
You are right to say TESTING IN IE FIRST IS VERY BIG MISTAKES ...
IE really S...ks if u work wiz CSS 2.0 !!!

Well i will try ur suggestion n come back to give more details..
thanks anyway :)
Jul 18 '08 #3
shailen21
4 New Member
First mistake: testing in IE first.

IE is sometimes lax on syntax. options is an array, so you need square brackets [], not round brackets/parentheses (), i.e. options[...]

Please enclose your code using code tags.
can you please give me an example using the above codes of the proposed solution using array instead of () ...

thanks
Jul 18 '08 #4
acoder
16,027 Recognized Expert Moderator MVP
Either:[html]<select name="select" class="booking" onchange="MM_op enBrWindow(this .options[this.selectedIn dex].value,'bookwin dow','')">[/html]or [html]<select name="select" class="booking" onchange="MM_op enBrWindow(this .value,'bookwin dow','')">[/html]this.value is a shortcut.
Jul 18 '08 #5
shailen21
4 New Member
Either:[html]<select name="select" class="booking" onchange="MM_op enBrWindow(this .options[this.selectedIn dex].value,'bookwin dow','')">[/html]or [html]<select name="select" class="booking" onchange="MM_op enBrWindow(this .value,'bookwin dow','')">[/html]this.value is a shortcut.
Damn it ... u r great :D
I was with that with more than 2 hrs ... loolllllzzz


It works :D

Thanks a lot ;)

many thanks again
Jul 18 '08 #6
acoder
16,027 Recognized Expert Moderator MVP
You're welcome. Pleased it's now working.
Jul 18 '08 #7

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

Similar topics

5
5145
by: Frowning Freezer | last post by:
I have a function in an external javascript file which I fire from an onChange event in a <SELECT> tag. Everything works fine in IE but not in Netscape/Mozilla/Opera. This is my onChange statement: onChange="division_changed(this.value);" If I put an alert() in the external script (outside any function) it executes fine. If I put an alert directly in onChange it also works fine! But this function that I'm calling simply won't get...
2
12163
by: Asit | last post by:
In JavaScripts checks for an onChange event against the value of the textbox at the time of the last onChange event. Since an onChange Event never fired after you changed the text first time , suppose we put the same value in the text box then no event is fired. If we put some other value then it became fired... It wouldn't fire if we put the same value... I don't want to use onBlur etc... Isthere any solution with onChange Event...?
4
6137
by: Bart van Deenen | last post by:
Hi all I have a script where I dynamically create multiple inputs and selects from a script. The inputs and selects must have an associated onchange handler. I have the script working fine on Firefox, Safari and Konqueror, but the onchange event just doesn't fire on IE6. Firefox's javascript console shows no errors, and the IE script debugger shows nothing. onchange is not triggered.
5
3463
by: Pascal Batzli Jr | last post by:
Hello, I have a strange situation happening on the code below. When I first load the page, as I change any of the three combo boxes I have created, the onchange event is fired and the form should be submitted, but it isn't for some weird reason. However, after I press the ok button, it submits the form, and then the combo boxes start working normally. In IE, everything works fine. I appreciate any help. Thank you. <html>
3
3987
by: jab3 | last post by:
Hello. I"m new to this group, and to JavaScript in general, so please forgive me if I breach local etiquette. I'm trying to implement some client-side 'dynamic' validation on a form. I'm having a couple of problems, which I'll try to describe. But this e-mail will only reproduce one of them, in a "short" example. What I'm generally doing is having each form entry contained in a div, which as a label, an input with some event handlers,...
7
8256
by: Bruno Alexandre | last post by:
Hi Guys, I'm having a HUGE problem with Javascript under IE, the code below belongs to a page http://filterqueen.brinkster.net/test.aspx it works fine under Firefox, but not in IE... does anyone knows how to add OnChange Script to work under IE as well?
7
3408
by: Peter | last post by:
Does anyone know how to trap SelectedIndexChanged event on the client side for the following control? http://www.metabuilders.com/Tools/ComboBox.aspx I have tried MyComboBox.Attributes.Add("OnChange", "return IndexChanged();"); but OnChange event never fires Thanks
1
5021
by: Jan Doggen | last post by:
Hello all, I have a SELECT like this (the 'alert()s are temporary): <FORM method="POST" action="/scripts/runisa.dll?OVB2.132964:PGSPLITVACAFMELDEN:1095144287.9159" id="hulpform" name="hulpform"> <select name="varVervuld" id="varVervuld" onChange="alert('Onchange');Vervuld(this.options);"> <option value="0" selected="selected">&nbsp;</option> <option value=JA>Ja</option>
3
32931
by: Mister Joe | last post by:
I have a page and if the user has javascript enables I am trying to dynamically change a link to a sitemap to a dropdown menu (that when the option is changed will forward the user to another page). Here's the code try{ var sel = document.createElement("select"); sel.setAttribute("onchange", "alert('');");
0
9480
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10325
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
10147
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
10091
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
8972
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
7499
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
6739
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4050
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3645
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.