Solved

OnLoad focus problems with Netscape

Posted on 2000-02-23
2
297 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
2 Comments
 

Accepted Solution

by:
npappas earned 50 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Capture logon name 13 70
How can I get this SlideToggle to behave? 6 23
execute script based on HTML event 7 22
how can i Return this word's max repeat count? 2 15
This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
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…

813 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now