Google Answers Logo
View Question
 
Q: Javascript help Explorer vs Mozilla ( No Answer,   6 Comments )
Question  
Subject: Javascript help Explorer vs Mozilla
Category: Computers
Asked by: hairymp-ga
List Price: $20.00
Posted: 02 May 2004 14:32 PDT
Expires: 26 May 2004 04:23 PDT
Question ID: 339942
To get selected options from a <select> into a PHP-array
you name the <select> with a name ending with []. 

The code below is working in Mozilla but not in Explorer.
How can I code it to work in both?


(selectbox.js from http://www.mattkruse.com/)

---------- code start

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</HEAD>

<BODY >
<script type="text/javascript" src="selectbox.js"></script>
<form name=form_pp action="url">
<select name=allproj multiple size=15
ondblclick="moveSelectedOptions(allproj,document.form_pp.elements['userproj[]'])">
 <option value="11">kjhg</option>
 <option value="12">kj76ghg</option>

</select>
      <input name=addproj type=button
onclick="moveSelectedOptions(allproj,
document.form_pp.elements['userproj[]'])" value=" -> "><br>
      <input name=addallproj type=button
onclick="selectAllOptions(allproj); addproj.click()" value=" >>
"><br><br>
      <input name=delallproj type=button
onclick="selectAllOptions(document.form_pp.elements['userproj[]']);
delproj.click()" value=" << "><br>
      <input name=delproj type=button
onclick="moveSelectedOptions(document.form_pp.elements['userproj[]'],
allproj)" value=" <- ">

      <select name="userproj[]" multiple size=15
ondblclick="moveSelectedOptions(document.form_pp.elements['userproj[]'],allproj)">
        <option value="9">kjhghj</option>
        <option value="10">jhg87</option>

      </select>
</form>

</BODY>
</HTML>

------------------- code end

Clarification of Question by hairymp-ga on 03 May 2004 06:51 PDT
Using W2k, IE 6.0.2800.1106 clicking buttons or
doubleclicking listbox items generates error.
Answer  
There is no answer at this time.

Comments  
Subject: Re: Javascript help Explorer vs Mozilla
From: yhal-ga on 03 May 2004 06:13 PDT
 
Please clarify, the supplied code works for both Mozilla 1.7b and IE
6.0.2800.1106.xpsp2.030422-1633, what do you get wrong?

I guess you're confusing yourself and 'userproj[]' is only weird
select control name with brackets w/o special meaning you want it to
have.
Subject: Re: Javascript help Explorer vs Mozilla
From: trippin_cracka-ga on 03 May 2004 12:55 PDT
 
It appears that the java runtime may not be functioning properly, In
internet explorer die to legal implecations microsoft chose to
discontinue support for java. To obtain is go to sun microsystems and
download the runtime. This will likely resolve your issue.

The site address http://www.java.com/en/index.jsp

Download the free java software.

cheers
Subject: Re: Javascript help Explorer vs Mozilla
From: hairymp-ga on 03 May 2004 23:31 PDT
 
But this is javascript, not java...
Subject: Re: Javascript help Explorer vs Mozilla
From: yhal-ga on 04 May 2004 02:22 PDT
 
hairymp-ga:
replace all occurences of 'userproj[]' with 'userproj' - it works w/o
'[]' too, and brackets are confusing.
make your code symmetric against form elements to read
ondclick="moveSelectedOptions(document.form_pp.elements['allproj'],document.form_pp.elements['userproj'])"
or onclick="moveSelectedOptions(allproj,userproj)".

I guess you've found a bug, bacause mozilla, ie and opera "works here (tm)".
Subject: Re: Javascript help Explorer vs Mozilla
From: hairymp-ga on 04 May 2004 02:40 PDT
 
the [] is what I wan't, it saves me from parsing the 
query-string in PHP...
Subject: Re: Javascript help Explorer vs Mozilla
From: chrisken-ga on 12 May 2004 11:46 PDT
 
I tried it in IE6 and it worked fine. Are you sure that you have
selectbox.js in the correct directory and with the correct
permissions? If you post the url to the actual website it would be
helpful.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy