By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,636 Members | 1,189 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,636 IT Pros & Developers. It's quick & easy.

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

P: 4
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
Share this Question
Share on Google+
6 Replies


acoder
Expert Mod 15k+
P: 16,027
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

P: 4
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

P: 4
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
Expert Mod 15k+
P: 16,027
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

P: 4
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
Expert Mod 15k+
P: 16,027
You're welcome. Pleased it's now working.
Jul 18 '08 #7

Post your reply

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