469,631 Members | 1,253 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

Object required problem cant figure out

hey there this script works fine in firefox.

but in ie the this call
Expand|Select|Wrap|Line Numbers
  1. document.getElementById(form).style.display='block';
gives me object required, well i don't know much about java and can't figure out how to make it work

EDIT: one thing to note is if i pass the value manually with " ' " it works fine im guessing its because form is passing like a string but wouldn't that be ok?!
some help please.

Thanks

Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">
  2. function display_form(form){
  3.     var pre = new Array(3);
  4.     pre[0] = 'ins_';
  5.     pre[1] = 'del_';
  6.     pre[2] = 'mod_';
  7.     var suf = new Array(3);
  8.     suf[0] = 'cli';
  9.     suf[1] = 'est';
  10.     suf[2] = 'enc';
  11.     var div_name = new Array(3);
  12.     for (var i=0;i<3;i++){
  13.         div_name[i] = new Array(3);
  14.     }    
  15.     for (var i=0;i<3;i++){
  16.         for(var j=0;j<3;j++){
  17.             div_name[i,j] = pre[j] + suf[i];
  18.             document.getElementById(div_name[i,j]).style.display='none';
  19.         }
  20.     }
  21.     document.getElementById(form).style.display='block';
  22. }
  23. </script>
  24.  
  25.  
  26. //AND this is the call
  27.  
  28.         <select onchange="javascript: display_form(document.getElementById('accao').value);" name="accao" id="accao">
  29.  
Oct 19 '07 #1
7 2093
gits
5,390 Expert Mod 4TB
hi ...

welcome to TSDN ...

try to rename the parameter of your function. may be IE handles that as a keyword ...

kind regards
Oct 19 '07 #2
hi ...

welcome to TSDN ...

try to rename the parameter of your function. may be IE handles that as a keyword ...

kind regards
na it still gives me object required =|
Oct 19 '07 #3
gits
5,390 Expert Mod 4TB
[HTML]<select onchange="javascript: display_form(document.getElementById('accao').valu e);" name="accao" id="accao">[/HTML]

is equivalent to:

Expand|Select|Wrap|Line Numbers
  1. <select onchange="display_form(this.value);" name="accao" id="accao">
could you trace what the value is and whether the element with that id exists?

kind regards
Oct 19 '07 #4
[HTML]<select onchange="javascript: display_form(document.getElementById('accao').valu e);" name="accao" id="accao">[/HTML]

is equivalent to:

Expand|Select|Wrap|Line Numbers
  1. <select onchange="display_form(this.value);" name="accao" id="accao">
could you trace what the value is and whether the element with that id exists?

kind regards
Im sorry it works now =O would u happen to know why? whats the difference?
Oct 19 '07 #5
gits
5,390 Expert Mod 4TB
what code do you use now? because i think there is no difference ... except IE may have problems when setting name and the id to equal values?
Oct 19 '07 #6
what code do you use now? because i think there is no difference ... except IE may have problems when setting name and the id to equal values?

only changed this.value like u recommended
Oct 19 '07 #7
gits
5,390 Expert Mod 4TB
could you try to use your old code and alert the param form as it is passed to the function? i assume it is undefined? ...
Oct 19 '07 #8

Post your reply

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

Similar topics

6 posts views Thread by Steve Richter | last post: by
1 post views Thread by Angus Lepper | last post: by
7 posts views Thread by Ibys | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.