Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

OnLoad focus problems with Netscape

Posted on 2000-02-23
2
Medium Priority
?
302 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 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
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…
Suggested Courses

916 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