File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes HTML, CSS and JavaScript and the fly likes Famous Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Famous "Object  expected"error,Wishing Browser Independent" Watch "Famous "Object  expected"error,Wishing Browser Independent" New topic

Famous "Object expected"error,Wishing Browser Independent

vaibhav punekar
Ranch Hand

Joined: Jan 20, 2001
Posts: 134
Hi all Java gurus,
u all might have faced the famous javascript error ie"Object expected" and similarly might have faced browser dependency problem.I hope these problems would be sorted out soon so that we developers are relieved of the load of debugging javascript.
I request you all to please start a list mentioning the circumstances in which 'this' error occurs and the possible remedy over it.So that it will be useful to all developers.Do you all agree guys?Thanks and expecting a huge list.

bill bozeman
Ranch Hand

Joined: Jun 30, 2000
Posts: 1070
There can be such a huge discrepencies between Netscape and IE's javascript calls, and even more when you go from 2.0 to 5.0 browsers. I think most of us see it as just a pain that we have to deal with because there is no way that it will ever be the same. So knowing the differences is the key. Or what I do is not memorize the differences, but now how to fix it when it comes up. Let me tell you, my debugging skills sure has improved.
vaibhav punekar
Ranch Hand

Joined: Jan 20, 2001
Posts: 134
I m currently getting object expected error in the following code.Is it because I m using the the variables defined outside the javascript fn.
I m not able to fix it.Can anybody fix it please?Thanks.
out.println("<td><input type='button' value='Submit' onClick='return validation(req)'></td>"); //error here
out.println("<td><input type='reset' value='Cancel'></td>");
out.println(" </tr>");
out.println("<script language='javascript'>");
out.println(" function validation(HttpServletRequest req){ ");
out.println("{alert('Please Enter Login Name.');");
out.println("return false;}");
out.println("{alert('Please Enter Password.');");
out.println("return false;}");
/**********************JDBC CONNECTION************************/
con =DriverManager.getConnection("jdbc dbc:vaibhav","vaibhav","vaibhav");

String query="SELECT * FROM Administrator WHERE login=? AND password=?";
pstmt = con.prepareStatement(query);

//does not reach here---- while(

//defined at class level loginnamearr[i-1]=rst.getString("login");
out.println(" if(document.myform.loginname.value!="+loginnamearr[i-1]+") ");
out.println(" { alert('Login Name Incorrect.'); return false;} ");
out.println(" if(document.myform.password.value!="+passwordarr[i-1]+") ");
out.println(" { alert('Password Incorrect.'); return false;} ");
out.println(" else{ document.myform.submit();} ");
out.println(" return true;}");
I agree. Here's the link:
subject: Famous "Object expected"error,Wishing Browser Independent
jQuery in Action, 3rd edition