?
Solved

OnLoad focus problems with Netscape

Posted on 2000-02-23
2
Medium Priority
?
301 Views
Last Modified: 2008-03-06
I want to loginid text box to get the focus when the form loads.  The following code works great in IE but does not work in Netscape.
I get the Javascript error, "document.login has no properties".  

Can you tell me what I'm doing wrong?

Thanks

Corey

<%@ LANGUAGE="VBSCRIPT" %>
<%'Set employee cookie to nothing.
Response.Buffer = True
Response.Cookies("markCustomer").Expires = Date() - 1
      
'Retrieve login validation data if there is any.
invalidlogin = Request.Querystring("login")
%>

<html>
<head>
<meta HTTP-EQQUIV="Content-Type" CONTENT="text/html;charset=windows-1252">
<title>Login to Intelimind Customer Support</title>
<SCRIPT LANGUAGE="JavaScript"><!--//cloak
if (top.location.href != location.href)
      top.location.href = location.href;
//uncloak --></SCRIPT>
</head>

<body onload="document.login.loginid.focus();" BGCOLOR=#FFFFFF>
<span id="main" style="position:relative; z-index:1;">
<CENTER>
 <h1 align="center"><font face="AvantGarde Md BT" size="7"        color="#B22222">Intelimind</font></h1>
 <FORM NAME="login" ACTION="validation.asp" METHOD="GET"        Target=_top>
   <H2>Login to customer support</H2><P>
   <% 'Determine if the loginid/password is invalid.
          If invalidlogin="true" Then%>      
             <font face="Arial" size="4" color="Red">Invalid loginid or                      password</font>
        <%Else
                 If invalidlogin="inactive" Then%>                                                                       <font face="Arial" size="4" color="Red">Account has been                             inactivated</font>                   
           <%End If
           End If%>
                  
   <PRE>
    Login ID <INPUT TYPE="TEXT" NAME="loginid">
    Password <INPUT TYPE="PASSWORD" NAME="password">
   </PRE>
   <INPUT TYPE=SUBMIT  VALUE="Login">
   <INPUT TYPE=RESET   VALUE="Reset">
  </FORM>
  If you are new user click <a HREF="newuser.asp">here.</a>
  <br>
  <br>
  Forgot your password??  <a HREF="emailpass.asp">click here.</a>
 </CENTER>
 </span>
<span id="theWatermark" style="position:absolute; z-index:0; top:0; left:340">
<img  src="images/swirl.gif" width=400 height=400 border=0 alt="">
</span>
</body>
</html>
0
Comment
Question by:ckosloski
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 

Accepted Solution

by:
npappas earned 200 total points
ID: 2550558
onLoad is evil -- it never does *exactly* what you expect.

Remove onLoad and put the code block at the bottom:

....
<BODY BGCOLOR=#FFFFFF>
.....
.....
<SCRIPT LANGUAGE="JavaScript">
document.login.loginid.focus();
</SCRIPT>
</BODY>
</HTML>

This will do what onLoad should do, and it doesn't cause any problems.

Nick
0
 
LVL 4

Author Comment

by:ckosloski
ID: 2550602
I moved the script code after the end of the form (</form>) and it worked great!!

Thanks

Corey
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question