Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Object Expected Error help!!!

Status
Not open for further replies.

UniWebDude

Programmer
Aug 11, 2003
3
0
0
GB
Hi all,

I am getting a Javascript error :

Error : Object Expected

on line 65 of my page :


I am not a javascript programmer and this is a third party script so any help getting this sorted would be fantastic ! Below is the complete source code :

<html>
<head>
<title>UCC Portia Home</title>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;>
<SCRIPT language=&quot;javascript&quot;>
<!-- (hide from old browsers)
function xferFocus()
{
document.cplogin.pass.focus();
}

function login()
{
document.cplogin.user.value=document.userid.user.value;
document.cplogin.submit();
}
//-->
</SCRIPT>
<link href=&quot;css/UCCsept2002homeonly.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot;>
</head>

<body bgcolor=&quot;#666666&quot; topmargin=&quot;0&quot; rightmargin=&quot;0&quot;>
<center>

<table width=&quot;700&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;>
<tr>
<td align=&quot;center&quot; valign=&quot;middle&quot;><div align=&quot;center&quot;></div>
</td>
</tr>
<tr>
<td align=&quot;center&quot; valign=&quot;middle&quot;><table width=&quot;700&quot; border=&quot;1&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; bordercolor=&quot;#333333&quot; bgcolor=&quot;#CCCC66&quot;>
<tr>
<td colspan=&quot;4&quot;><img src=&quot;June%2003/greenbanner.jpg&quot; width=&quot;700&quot; height=&quot;70&quot;></td>
</tr>
<tr>
<td colspan=&quot;4&quot;><table width=&quot;100%&quot; border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; bgcolor=&quot;#FFFFFF&quot;>
<tr>
<td> </td>
<td valign=&quot;top&quot;> </td>
<td valign=&quot;top&quot;> </td>
<td> </td>
</tr>
<tr>
<td width=&quot;4%&quot;> </td>
<td width=&quot;29%&quot; valign=&quot;top&quot;>

<TABLE WIDTH=187 HEIGHT=175 BORDER=1 CELLPADDING=8 CELLSPACING=0 bordercolor=&quot;#666666&quot; bgcolor=&quot;#CCCC99&quot;>
<TR>
<TD>
<FORM NAME=&quot;userid&quot; onSubmit=&quot;xferFocus(this); return false;&quot;>
<font size=&quot;2&quot;>
<font face=&quot;Verdana, Arial, Helvetica, sans-serif&quot;>User Name:</font><BR>
<input type=&quot;text&quot; name=&quot;user&quot; size=15 tabindex=1 onFocus=&quot;hadFocus(true)&quot;>
<BR clear=&quot;all&quot;>
</font>
</FORM>
<FORM NAME=&quot;cplogin&quot; action=&quot; onSubmit=&quot;login(); return false;&quot; method=&quot;post&quot;>
<font size=&quot;2&quot;>
<font face=&quot;Verdana, Arial, Helvetica, sans-serif&quot;>Password :</font><BR>
<input type=&quot;password&quot; name=&quot;pass&quot; size=15 tabindex=2 onFocus=&quot;hadFocus(true)&quot;>
</FONT>
<input type=&quot;hidden&quot; name=&quot;user&quot; value=&quot;&quot;>

</FORM>
<CENTER>
<p><font size=&quot;2&quot;><a href=&quot;javascript:login();&quot; onMouseover=&quot;window.status=''; return true;&quot;><IMG SRC=&quot;/June%2003/ok.gif&quot; NAME=&quot;ok_btn&quot; ALT=&quot;OK&quot; BORDER=0 HSPACE=3 VSPACE=7 WIDTH=62 HEIGHT=18 tabindex=3 onLoad=&quot;clearCache()&quot;></A><A href=&quot;javascript:doCancel();&quot; onMouseover=&quot;window.status=''; return true;&quot;><IMG SRC=&quot;/June%2003/cancel.gif&quot; NAME=&quot;cancel_btn&quot; ALT=&quot;Cancel&quot; BORDER=0 HSPACE=3 VSPACE=7 WIDTH=62 HEIGHT=18 tabindex=4></A></font></p>
<p>
</p>
</CENTER>

</TR>
</TABLE>

</td>
<td width=&quot;64%&quot; valign=&quot;top&quot;><p><font face=&quot;Geneva, Arial, Helvetica, san-serif&quot;><strong><font size=&quot;2&quot;>Welcome
to Portia version 2</font></strong><font size=&quot;2&quot;>. </font></font></p>
<p><font size=&quot;2&quot;><strong><em>PASSWORDS HAVE BEEN RESET</em></strong></font></p>
<p><font size=&quot;2&quot;> <strong><em>Your new password is your student
ID followed by your date of birth.</em></strong></font></p>
<p>Apart from this page you should not notice any changes
to the functionality of Portia. The idea of this update
is to increase the speed of the system, so loading calendar
and email should be quicker.</p>
<p><strong>About Portia</strong></p>
<p>This secure site provides UCC students, academic and administrative
staff with world-class Intranet and Internet services. This
is where you can check e-mail, register for courses, and
explore the Internet.</p>
<p> </p>
</td>
<td width=&quot;3%&quot;> </td>
</tr>
<tr>
<td> </td>
<td><div align=&quot;center&quot;></div></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td colspan=&quot;2&quot;> </td>
<td> </td>
</tr>
</table>
</td>
</tr>
</table>
</table></center></body>
</html>
 
I found 2 places on the page that generates the error and removed the lines in both places that said onFocus=&quot;hadFocus(true)&quot; and the errors disappeared. Try this..

<html>
<head>
<title>UCC Portia Home</title>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;>
<SCRIPT language=&quot;javascript&quot;>
<!-- (hide from old browsers)
function xferFocus()
{
document.cplogin.pass.focus();
}

function login()
{
document.cplogin.user.value=document.userid.user.value;
document.cplogin.submit();
}
//-->
</SCRIPT>
<link href=&quot;css/UCCsept2002homeonly.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot;>
</head>

<body bgcolor=&quot;#666666&quot; topmargin=&quot;0&quot; rightmargin=&quot;0&quot;>
<center>

<table width=&quot;700&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;>
<tr>
<td align=&quot;center&quot; valign=&quot;middle&quot;><div align=&quot;center&quot;></div>
</td>
</tr>
<tr>
<td align=&quot;center&quot; valign=&quot;middle&quot;><table width=&quot;700&quot; border=&quot;1&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; bordercolor=&quot;#333333&quot; bgcolor=&quot;#CCCC66&quot;>
<tr>
<td colspan=&quot;4&quot;><img src=&quot;June%2003/greenbanner.jpg&quot; width=&quot;700&quot; height=&quot;70&quot;></td>
</tr>
<tr>
<td colspan=&quot;4&quot;><table width=&quot;100%&quot; border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; bgcolor=&quot;#FFFFFF&quot;>
<tr>
<td> </td>
<td valign=&quot;top&quot;> </td>
<td valign=&quot;top&quot;> </td>
<td> </td>
</tr>
<tr>
<td width=&quot;4%&quot;> </td>
<td width=&quot;29%&quot; valign=&quot;top&quot;>

<TABLE WIDTH=187 HEIGHT=175 BORDER=1 CELLPADDING=8 CELLSPACING=0 bordercolor=&quot;#666666&quot; bgcolor=&quot;#CCCC99&quot;>
<TR>
<TD>
<FORM NAME=&quot;userid&quot; onSubmit=&quot;xferFocus(this); return false;&quot;>
<font size=&quot;2&quot;>
<font face=&quot;Verdana, Arial, Helvetica, sans-serif&quot;>User Name:</font><BR>
<input type=&quot;text&quot; name=&quot;user&quot; size=15 tabindex=1>
<BR clear=&quot;all&quot;>
</font>
</FORM>
<FORM NAME=&quot;cplogin&quot; action=&quot; onSubmit=&quot;login(); return false;&quot; method=&quot;post&quot;>
<font size=&quot;2&quot;>
<font face=&quot;Verdana, Arial, Helvetica, sans-serif&quot;>Password :</font><BR>
<input type=&quot;password&quot; name=&quot;pass&quot; size=15 tabindex=2>
</FONT>
<input type=&quot;hidden&quot; name=&quot;user&quot; value=&quot;&quot;>

</FORM>
<CENTER>
<p><font size=&quot;2&quot;><a href=&quot;javascript:login();&quot; onMouseover=&quot;window.status=''; return true;&quot;><IMG SRC=&quot;/June%2003/ok.gif&quot; NAME=&quot;ok_btn&quot; ALT=&quot;OK&quot; BORDER=0 HSPACE=3 VSPACE=7 WIDTH=62 HEIGHT=18 tabindex=3 onLoad=&quot;clearCache()&quot;></A><A href=&quot;javascript:doCancel();&quot; onMouseover=&quot;window.status=''; return true;&quot;><IMG SRC=&quot;/June%2003/cancel.gif&quot; NAME=&quot;cancel_btn&quot; ALT=&quot;Cancel&quot; BORDER=0 HSPACE=3 VSPACE=7 WIDTH=62 HEIGHT=18 tabindex=4></A></font></p>
<p>
</p>
</CENTER>

</TR>
</TABLE>

</td>
<td width=&quot;64%&quot; valign=&quot;top&quot;><p><font face=&quot;Geneva, Arial, Helvetica, san-serif&quot;><strong><font size=&quot;2&quot;>Welcome
to Portia version 2</font></strong><font size=&quot;2&quot;>. </font></font></p>
<p><font size=&quot;2&quot;><strong><em>PASSWORDS HAVE BEEN RESET</em></strong></font></p>
<p><font size=&quot;2&quot;> <strong><em>Your new password is your student
ID followed by your date of birth.</em></strong></font></p>
<p>Apart from this page you should not notice any changes
to the functionality of Portia. The idea of this update
is to increase the speed of the system, so loading calendar
and email should be quicker.</p>
<p><strong>About Portia</strong></p>
<p>This secure site provides UCC students, academic and administrative
staff with world-class Intranet and Internet services. This
is where you can check e-mail, register for courses, and
explore the Internet.</p>
<p> </p>
</td>
<td width=&quot;3%&quot;> </td>
</tr>
<tr>
<td> </td>
<td><div align=&quot;center&quot;></div></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td colspan=&quot;2&quot;> </td>
<td> </td>
</tr>
</table>
</td>
</tr>
</table>
</table></center></body>
</html>

Hope this helps you out,

Brian
 
Hi Brian,

Thank-you for your help - I really appriciate it. I have published your script to :


but using IE 6.0 still get an Error : Object Expected message in the bottom left of the screen,

Matt.
 
Hey Matt,

Sorry about that. I promise the code that I posted worked on my local machine without error, so I went to the link you just provided and duplicated the error. I did a little more trimming to your code and believe the submit function is working properly. Then the cancel function raised an error so I trimmed and added the function doCancel() which was called but was not in the script. I just set the actions it does to clear the boxes (user, pass) and basically do nothing else (it just will not submit the form when cancelled). I hope this works for you and is what you want. Give this a try...

<html>
<head>
<title>UCC Portia Home</title>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;>
<SCRIPT language=&quot;javascript&quot;>
<!-- (hide from old browsers)
function xferFocus()
{
document.cplogin.pass.focus();
}

function login()
{
document.cplogin.user.value=document.userid.user.value;
document.cplogin.submit();
}
function doCancel()
{
document.userid.user.value = &quot;&quot;;
document.cplogin.user.value= &quot;&quot;;
document.cplogin.pass.value= &quot;&quot;;
}
//-->
</SCRIPT>
<link href=&quot;css/UCCsept2002homeonly.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot;>
</head>

<body bgcolor=&quot;#666666&quot; topmargin=&quot;0&quot; rightmargin=&quot;0&quot;>
<center>

<table width=&quot;700&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;>
<tr>
<td align=&quot;center&quot; valign=&quot;middle&quot;><div align=&quot;center&quot;></div>
</td>
</tr>
<tr>
<td align=&quot;center&quot; valign=&quot;middle&quot;><table width=&quot;700&quot; border=&quot;1&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; bordercolor=&quot;#333333&quot; bgcolor=&quot;#CCCC66&quot;>
<tr>
<td colspan=&quot;4&quot;><img src=&quot;June%2003/greenbanner.jpg&quot; width=&quot;700&quot; height=&quot;70&quot;></td>
</tr>
<tr>
<td colspan=&quot;4&quot;><table width=&quot;100%&quot; border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; bgcolor=&quot;#FFFFFF&quot;>
<tr>
<td> </td>
<td valign=&quot;top&quot;> </td>
<td valign=&quot;top&quot;> </td>
<td> </td>
</tr>
<tr>
<td width=&quot;4%&quot;> </td>
<td width=&quot;29%&quot; valign=&quot;top&quot;>

<p>&nbsp;</p><TABLE WIDTH=187 HEIGHT=175 BORDER=1 CELLPADDING=8 CELLSPACING=0 bordercolor=&quot;#666666&quot; bgcolor=&quot;#CCCC99&quot;>
<TR>
<TD>
<FORM NAME=&quot;userid&quot; onSubmit=&quot;xferFocus(this); return false;&quot;>
<font size=&quot;2&quot;>
<font face=&quot;Verdana, Arial, Helvetica, sans-serif&quot;>User Name:</font><BR>
<input type=&quot;text&quot; name=&quot;user&quot; size=15 tabindex=1>
<BR clear=&quot;all&quot;>
</font>
</FORM>
<FORM NAME=&quot;cplogin&quot; action=&quot; onSubmit=&quot;login(); return false;&quot; method=&quot;post&quot;>
<font size=&quot;2&quot;>
<font face=&quot;Verdana, Arial, Helvetica, sans-serif&quot;>Password :</font><BR>
<input type=&quot;password&quot; name=&quot;pass&quot; size=15 tabindex=2>
</FONT>
<input type=&quot;hidden&quot; name=&quot;user&quot; value=&quot;&quot;>

</FORM>
<CENTER>
<p><font size=&quot;2&quot;>
<a href=&quot;javascript:login();&quot;>
<IMG SRC=&quot;/June%2003/ok.gif&quot; NAME=&quot;ok_btn&quot; ALT=&quot;OK&quot; BORDER=0 HSPACE=3 VSPACE=7 WIDTH=62 HEIGHT=18 tabindex=3 onLoad=&quot;clearCache()&quot;></A>
<A href=&quot;javascript:doCancel();&quot;><IMG SRC=&quot;/June%2003/cancel.gif&quot; NAME=&quot;cancel_btn&quot; ALT=&quot;Cancel&quot; BORDER=0 HSPACE=3 VSPACE=7 WIDTH=62 HEIGHT=18 tabindex=4></A></font></p>
<p>
</p>
</CENTER>

</TR>
</TABLE>

</td>
<td width=&quot;64%&quot; valign=&quot;top&quot;><p><font face=&quot;Geneva, Arial, Helvetica, san-serif&quot;><strong><font size=&quot;2&quot;>Welcome
to Portia version 2</font></strong><font size=&quot;2&quot;>. </font></font></p>
<p><font size=&quot;2&quot;><strong><em>PASSWORDS HAVE BEEN RESET</em></strong></font></p>
<p><font size=&quot;2&quot;> <strong><em>Your new password is your student
ID followed by your date of birth.</em></strong></font></p>
<p>Apart from this page you should not notice any changes
to the functionality of Portia. The idea of this update
is to increase the speed of the system, so loading calendar
and email should be quicker.</p>
<p><strong>About Portia</strong></p>
<p>This secure site provides UCC students, academic and administrative
staff with world-class Intranet and Internet services. This
is where you can check e-mail, register for courses, and
explore the Internet.</p>
<p> </p>
</td>
<td width=&quot;3%&quot;> </td>
</tr>
<tr>
<td> </td>
<td><div align=&quot;center&quot;></div></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td colspan=&quot;2&quot;> </td>
<td> </td>
</tr>
</table>
</td>
</tr>
</table>
</table></center></body>
</html>

By the way, if this works for you then you may have another issue. When transferring to the next page after sign in I get the alert box about secure and non secure items on the page. If I select &quot;NO&quot; to display the non secure items another error arises. You will need to address such an issue to handle the error (perhaps a try/catch statement). This error is on the next page and not the page you posted. Good luck and let me know


Brian
 
the problem is with a call to a function called clearCache which gets called when the /June%2003/ok.gif image loads.

This clearCache function does not exist on your page.

Go back to where you got this from and look for the function on the page and copy it to yours. May be a bit more involved than a simple copy though.
You may find the function exists in a external js file.

Good luck with sorting it out

on error goto hell
 
Thank-you both so much for your help with this ! My faith in the human race has been boosted ! I will dig around on the server for some rogue .js files,

Matt.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top