Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript
|
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 13th, 2006, 04:29 PM
Registered User
 
Join Date: Apr 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default error on page: object expected

Ii have the following error when i click login after entering username and password... Pls help

Error Line: 44
Char: 5
Error: Object Expected
Code: 0

*****
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
    <TITLE>HitScript - Admin area</TITLE>
    <META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <META http-equiv="Document-State" content="dynamic">
    <META http-equiv="Pragma" content="no-cache">
    <META http-equiv="Cache-Control" content="no-cache">
    <BASE href="/">
    <LINK rel="stylesheet" type="text/css" href="/resources/css/main.css">
    <SCRIPT type="text/javascript" language="JavaScript" src="/resources/js/main.js"></SCRIPT>
    <SCRIPT type="text/javascript" language="JavaScript">var base='/';</SCRIPT>
</HEAD>

<BODY leftmargin="10" topmargin="10" marginwidth="10" marginheight="10">

<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">

<TR>
    <TD>
        <TABLE width="750" border="0" cellspacing="0" cellpadding="0">
        <TR>
            <TD class="maintitle">ADMIN AREA</TD>
        </TR>
        </TABLE>


        </TD>
    </TR>
    </TABLE>

<TABLE width=100% border=0 cellspacing=0 cellpadding=0>
<TR>
    <TD>
        <TABLE width=100% border=0 cellspacing=0 cellpadding=2>
        <TR><TD align=center valign=top><FORM name="data" method="post" action="admins/login/check.php">
<INPUT type="hidden" name="md5pswd">
<SCRIPT type="text/javascript" language="JavaScript" src="/resources/js/md5.js"></SCRIPT>
<SCRIPT type="text/javascript" language="JavaScript">
    document.data.onsubmit=function(){
         with(document.data){
            if(username.value!='' && password.value!='') {
                md5pswd.value=md5(password.value);
                password.value='';
            } else md5pswd.value=''
        }
    }
</SCRIPT>
<BR>
<BR>
<TABLE width="400" border="1" cellspacing="1" cellpadding="2" align="center" class="grid">
 <TR class="grid">
  <TH colspan="2" class="grid"><BIG>Admin Log In</BIG></TH>
 </TR>
 <TR class="grid">
  <TD colspan="2" class="grid1">
      Enter your username and password below. </TD>
 </TR>
 <TR class="grid">
  <TD width="40%" align="right" class="grid1"><B>Username</B></TD>
  <TD width="60%" class="grid2"><INPUT class="input" type="text" name="username" value="" maxlength="64"></TD>
 </TR>
 <TR class="grid">
  <TD align="right" class="grid1"><B>Password</B></TD>
  <TD class="grid2"><INPUT class="input" type="password" name="password" maxlength="64"></TD>
 </TR>
 <TR class="grid">
  <TD colspan="2" align="center" class="grid2">
   <TABLE width="100" border="0" cellspacing="0" cellpadding="0" align="center">
    <TR><TD>
     <INPUT class="button" type="submit" name="login" value="Login" width="100">
    </TD></TR>
   </TABLE>
  </TD>
 </TR>
 <TR class="grid">
  <TD colspan="2" align="center" class="grid1"><A href="admins/forgotten/password.php">I forgot my password</A></TD>
 </TR>
</TABLE>
</FORM>
</TD></TR>
        </TABLE>
    </TD>
</TR>
</TABLE>

</BODY>
</HTML>
 
Old April 15th, 2006, 04:00 AM
Friend of Wrox
 
Join Date: Oct 2004
Posts: 553
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to vinod_yadav1919 Send a message via Yahoo to vinod_yadav1919
Default

Hii Eggoose!!
Try to check with

<SCRIPT type="text/javascript" language="JavaScript">
    document.data.onsubmit=function(){
         with(document.data){


                alert(username.value)
         alert(password.value)
            if(username.value!='' && password.value!='') {
               alert(md5(password.value))
                md5pswd.value=md5(password.value);
                password.value='';
            } else md5pswd.value=''
        }
    }
</SCRIPT>

Try to check username and password,
then check for function md5(password.value) value.

Note- if you are getting the Error Line: 44 msg before the alert(username) it means there must be an error in ur included js file.Since when page is loaded on the browser all included js file code will also be rendered internally line by line, as sometimes i found the same situation in my code.

Hope this will help you


Cheers :)

vinod
 
Old April 17th, 2006, 03:54 AM
Registered User
 
Join Date: Apr 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by vinod_yadav1919
 Hii Eggoose!!
Try to check with

<SCRIPT type="text/javascript" language="JavaScript">
    document.data.onsubmit=function(){
         with(document.data){


                alert(username.value)
         alert(password.value)
            if(username.value!='' && password.value!='') {
             alert(md5(password.value))
                md5pswd.value=md5(password.value);
                password.value='';
            } else md5pswd.value=''
        }
    }
</SCRIPT>

Try to check username and password,
then check for function md5(password.value) value.

Note- if you are getting the Error Line: 44 msg before the alert(username) it means there must be an error in ur included js file.Since when page is loaded on the browser all included js file code will also be rendered internally line by line, as sometimes i found the same situation in my code.

Hope this will help you


Cheers :)

vinod
Vinod...
Thanx for da response. Two things, wot do you mean by :
"Try to check username and password,
then check for function md5(password.value) value."

I have inserted the code your provided with the alert for passwrd and usrname, i do get the alerts on the screen but still get an error. I seems the error comes when the line

 if(username.value!='' && password.value!=''){

is executed. coz this is still where the error appears even after inserting your suggested code.

:(

 
Old April 18th, 2006, 07:49 AM
Friend of Wrox
 
Join Date: Oct 2004
Posts: 553
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to vinod_yadav1919 Send a message via Yahoo to vinod_yadav1919
Default

Hii Eggoose!!

<SCRIPT type="text/javascript" language="JavaScript">
    document.data.onsubmit=function(){
         with(document.data){


                alert(username.value)
         alert(password.value)
            if(username.value!='' && password.value!='') {
               alert(md5(password.value)) //r u getting this value
                md5pswd.value=md5(password.value);
                password.value='';
            } else md5pswd.value=''
        }
    }
</SCRIPT>

r u getting alert messsage for this ->>md5(password.value)In above script


**********************plz copy below html and check the values***********


<BODY leftmargin="10" topmargin="10" marginwidth="10" marginheight="10">

<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">

<TR>
    <TD>
        <TABLE width="750" border="0" cellspacing="0" cellpadding="0">
        <TR>
            <TD class="maintitle">ADMIN AREA</TD>
        </TR>
        </TABLE>


        </TD>
    </TR>
    </TABLE>

<TABLE width=100% border=0 cellspacing=0 cellpadding=0>
<TR>
    <TD>
        <TABLE width=100% border=0 cellspacing=0 cellpadding=2>
        <TR><TD align=center valign=top><FORM name="data" method="post" onsubmit="return isValidate()" action="admins/login/check.php">
<INPUT type="text" name="md5pswd">

<SCRIPT type="text/javascript" language="JavaScript">
window.onerror = errorHandler
function errorHandler(errorMessage, url, line)
    {
    msgs= "Error message:-->> " + errorMessage + "\n";
    msgs += "url:-->>" + url + "\n";
    msgs += "Line Number :-->> " + line;
    alert(msgs);
    return true
    }

    function isValidate()
    {
         with(document.data){
         alert(username.value)
         alert(password.value)
         alert(username.value!='')
         alert(password.value!='')
         alert(username.value!=' ')
         alert(password.value!=' ')
          // if(username.value!=' ' && password.value!=' ') //comment below one and commentout this if statement
           if(username.value!='' && password.value!='')
             {
                alert("called")
                md5pswd.value=11
                password.value='';
            } else md5pswd.value=''


        alert(md5pswd.value)
        alert("Return")
        return false
        }

    }
</SCRIPT>
<BR>
<BR>
<TABLE width="400" border="1" cellspacing="1" cellpadding="2" align="center" class="grid">
 <TR class="grid">
  <TH colspan="2" class="grid"><BIG>Admin Log In</BIG></TH>
 </TR>
 <TR class="grid">
  <TD colspan="2" class="grid1">
      Enter your username and password below. </TD>
 </TR>
 <TR class="grid">
  <TD width="40%" align="right" class="grid1"><B>Username</B></TD>
  <TD width="60%" class="grid2"><INPUT class="input" type="text" name="username" value="" maxlength="64"></TD>
 </TR>
 <TR class="grid">
  <TD align="right" class="grid1"><B>Password</B></TD>
  <TD class="grid2"><INPUT class="input" type="password" name="password" maxlength="64"></TD>
 </TR>
 <TR class="grid">
  <TD colspan="2" align="center" class="grid2">
   <TABLE width="100" border="0" cellspacing="0" cellpadding="0" align="center">
    <TR><TD>
     <INPUT class="button" type="submit" name="login" value="Login" width="100">
    </TD></TR>
   </TABLE>
  </TD>
 </TR>
 <TR class="grid">
  <TD colspan="2" align="center" class="grid1"><A href="admins/forgotten/password.php">I forgot my password</A></TD>
 </TR>
</TABLE>
</FORM>
</TD></TR>
        </TABLE>
    </TD>
</TR>
</TABLE>

</BODY>
</HTML>
************************************************** ************************

Two things to be noticed
 alert(username.value!='')
 alert(password.value!='')
 will return false when u leave empty the username ,password and click on the submit button
 while
 alert(username.value!=' ')
 alert(password.value!=' ')


Hope this will help you

Cheers :)

vinod
 
Old April 19th, 2006, 01:36 AM
Registered User
 
Join Date: Apr 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

still no joy... i am nw getting a box on top of my loging table and if i enter my details, # 11 appears in this box but still cant proceed from there.

 
Old April 19th, 2006, 02:14 AM
Friend of Wrox
 
Join Date: Oct 2004
Posts: 553
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to vinod_yadav1919 Send a message via Yahoo to vinod_yadav1919
Default

Hi Eggoose!!
i have put return false in order to work with it you need to make it return true.
also i have mentioned to replace
       if(username.value!='' && password.value!='')
with
       if(username.value!=' ' && password.value!=' ')
in ur existing code.


Cheers :)

vinod





Similar Threads
Thread Thread Starter Forum Replies Last Post
Getting Object Expected error on mouseover event nrlahoti ASP.NET 2.0 Professional 10 March 15th, 2008 11:30 AM
Object expected error hericles Javascript How-To 1 July 19th, 2007 10:21 AM
object expected crmpicco Javascript 3 April 19th, 2006 09:07 AM
run time error: Object expected shoakat Classic ASP Databases 5 September 22nd, 2004 03:17 PM
object expected shoakat Classic ASP Databases 3 September 20th, 2004 08:12 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.