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

JS function is not working in IE

AMT India
P: 64
This JS function is not working in IE 6 and 7..

Expand|Select|Wrap|Line Numbers
  1. function ValidateRows( checkbox_id ){    
  2.  
  3.     if( document.pageform.eval(checkbox_id).value){
  4.  
  5.         if ( document.pageform.eval(checkbox_id).checked ){
  6.             return true;
  7.         }
  8.     }
  9.     for ( var i=0; i < document.pageform.eval(checkbox_id).length;i ++ ){
  10.         if ( document.pageform.eval(checkbox_id)[i].checked ){
  11.             return true;
  12.         }
  13.     }
  14.     return false;
  15. }
  16.  
The error is 'Object does not support this property or method'. The error line number is the first line of the function.
Oct 8 '07 #1
Share this Question
Share on Google+
4 Replies


dmjpro
100+
P: 2,476
This JS function is not working in IE 6 and 7..

Expand|Select|Wrap|Line Numbers
  1. function ValidateRows( checkbox_id ){    
  2.  
  3.     if( document.pageform.eval(checkbox_id).value){
  4.  
  5.         if ( document.pageform.eval(checkbox_id).checked ){
  6.             return true;
  7.         }
  8.     }
  9.     for ( var i=0; i < document.pageform.eval(checkbox_id).length;i ++ ){
  10.         if ( document.pageform.eval(checkbox_id)[i].checked ){
  11.             return true;
  12.         }
  13.     }
  14.     return false;
  15. }
  16.  
The error is 'Object does not support this property or method'. The error line number is the first line of the function.
"eval" is a member function of "window" object.

You should use like ............
Expand|Select|Wrap|Line Numbers
  1. eval("document.pageform.checkbox_id").value
  2.  
instead of ............... "document.pageform.eval(checkbox_id).value"

Debasis Jana
Oct 8 '07 #2

gits
Expert Mod 5K+
P: 5,390
hi ...

you don't need eval at all here ... simply use the correct reference (array-like in this case):

Expand|Select|Wrap|Line Numbers
  1. document.pageform[checkbox_id].value
kind regards
Oct 8 '07 #3

AMT India
P: 64
hi ...

you don't need eval at all here ... simply use the correct reference (array-like in this case):

Expand|Select|Wrap|Line Numbers
  1. document.pageform[checkbox_id].value
kind regards

Thanx for the replies....Both of the above code is working in IE....but not in Firefox....
Oct 8 '07 #4

gits
Expert Mod 5K+
P: 5,390
hi ...

simply use the standards-compliant method to retrieve the nodes:

Expand|Select|Wrap|Line Numbers
  1. var node = document.getElementById('your_id');
  2.  
and for the value you may then use:

Expand|Select|Wrap|Line Numbers
  1. var val = node.value;
kind regards
Oct 8 '07 #5

Post your reply

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