Famous "Object expected"error,Wishing Browser Independent
vaibhav punekar
Ranch Hand
Joined: Jan 20, 2001
Posts: 134
posted
0
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.
VAIBHAV <BR>SCJP
bill bozeman
Ranch Hand
Joined: Jun 30, 2000
Posts: 1070
posted
0
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. Bill
vaibhav punekar
Ranch Hand
Joined: Jan 20, 2001
Posts: 134
posted
0
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. -----------------------code---------------------------- 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("</form>"); out.println("</table>"); out.println("</center>"); out.println("</div>"); out.println("</body>"); out.println("<script language='javascript'>"); out.println("<!--"); out.println(" function validation(HttpServletRequest req){ "); out.println("if(document.myform.loginname.value.length==0)"); out.println("{alert('Please Enter Login Name.');"); out.println("return false;}"); out.println("if(document.myform.password.value.length==0)"); out.println("{alert('Please Enter Password.');"); out.println("return false;}"); /**********************JDBC CONNECTION************************/ try { i=1; Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); con =DriverManager.getConnection("jdbc dbc:vaibhav","vaibhav","vaibhav");
String query="SELECT * FROM Administrator WHERE login=? AND password=?"; pstmt = con.prepareStatement(query); pstmt.setString(1,req.getParameter("loginname"));i++; pstmt.setString(2,req.getParameter("password"));i++; rst=pstmt.executeQuery();