473,395 Members | 1,676 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,395 software developers and data experts.

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

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 3821
acoder
16,027 Expert Mod 8TB
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
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
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 Expert Mod 8TB
Either:[html]<select name="select" class="booking" onchange="MM_openBrWindow(this.options[this.selectedIndex].value,'bookwindow','')">[/html]or [html]<select name="select" class="booking" onchange="MM_openBrWindow(this.value,'bookwindow', '')">[/html]this.value is a shortcut.
Jul 18 '08 #5
Either:[html]<select name="select" class="booking" onchange="MM_openBrWindow(this.options[this.selectedIndex].value,'bookwindow','')">[/html]or [html]<select name="select" class="booking" onchange="MM_openBrWindow(this.value,'bookwindow', '')">[/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 Expert Mod 8TB
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
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:...
2
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 ,...
4
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...
5
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...
3
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...
7
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...
7
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...
1
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"...
3
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...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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,...
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...

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.