469,344 Members | 5,418 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,344 developers. It's quick & easy.

disable multiple select box

hi,

i want disable the select box...
Expand|Select|Wrap|Line Numbers
  1. <script>
  2. document.frmreq.selintloc.disabled=true;
  3. </script>
  4.  
  5.  
  6. <select name=selitloc[] mutiple=mutiple>
  7. <option value=chennai>chennai</option>
  8. <option value=salem>salem</option>
  9. </select>
  10.  
Feb 25 '08 #1
6 1778
hsriat
1,654 Expert 1GB
Look at this example
Feb 25 '08 #2
vee10
141 100+
Hi,

I think document.form cannot identify the name it can identify the id's only
if u change the name to id then it works fine

instead of <select name=selitloc[] mutiple=mutiple>

use <select id=selitloc[] mutiple=mutiple>



hi,

i want disable the select box...
Expand|Select|Wrap|Line Numbers
  1. <script>
  2. document.frmreq.selintloc.disabled=true;
  3. </script>
  4.  
  5.  
  6. <select name=selitloc[] mutiple=mutiple>
  7. <option value=chennai>chennai</option>
  8. <option value=salem>salem</option>
  9. </select>
  10.  
Feb 25 '08 #3
acoder
16,027 Expert Mod 8TB
hi,

i want disable the select box...
Expand|Select|Wrap|Line Numbers
  1. <script>
  2. document.frmreq.selintloc.disabled=true;
  3. </script>
  4.  
document.frmreq.elements["selintloc[]"].disabled=true;
Feb 25 '08 #4
acoder
16,027 Expert Mod 8TB
Hi,

I think document.form cannot identify the name it can identify the id's only
if u change the name to id then it works fine

instead of <select name=selitloc[] mutiple=mutiple>

use <select id=selitloc[] mutiple=mutiple>
No, you can identify an element by its name. Anyway, what you're suggesting would be incorrect. It might work in IE, but it's wrong. I don't think an id can have square brackets. If you did give an element an id, the correct way to refer to it would be with document.getElementById.
Feb 25 '08 #5
vee10
141 100+
ok i am not sure abt that thats why i told i think so
anyway thanks for clarifying my doubt but why it is giving null or not an object if we are using name and invoking it.can u clarify that also


No, you can identify an element by its name. Anyway, what you're suggesting would be incorrect. It might work in IE, but it's wrong. I don't think an id can have square brackets. If you did give an element an id, the correct way to refer to it would be with document.getElementById.
Feb 25 '08 #6
acoder
16,027 Expert Mod 8TB
ok i am not sure abt that thats why i told i think so
anyway thanks for clarifying my doubt but why it is giving null or not an object if we are using name and invoking it.can u clarify that also
Because the element is called "selintloc[]" (with the brackets). See post #4.
Feb 25 '08 #7

Post your reply

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

Similar topics

6 posts views Thread by Jonathan Ellis | last post: by
16 posts views Thread by Barry Gilmore | last post: by
4 posts views Thread by =?Utf-8?B?TUNN?= | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.