MozillaZine

Help! Need to clear login form onload - Mozilla no likey.

Discuss building things with or for the Mozilla Platform.
delarocha
 
Posts: 2
Joined: April 5th, 2006, 9:29 am
Location: Denver, CO
April 5th, 2006, 9:32 am

Post Posted April 5th, 2006, 9:32 am

I've tried applying a number of scripts that are suppose to clear input/password form fields onload, but for whatever reason these scripts dont' seem to work in Mozilla browsers. I've also checked the browser settings to make sure I have form data saving turned off. Can anyone help?
Word.

texmex
 
Posts: 403
Joined: March 26th, 2006, 8:58 am
Location: NE Lincs
April 6th, 2006, 8:29 am

Post Posted April 6th, 2006, 8:29 am

As a workaround you could perhaps introduce a delay to wait until FF has done it's stuff, and THEN clear it.

The following would add a half secod delay, (probably enough time for FF to have finished it's interferance).
Code: Select all
  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta http-equiv="content-type" content="text/html; charset=windows-1250">
    <title>Whatever</title> 
    <script language="javaScript">

      function clearfields()
        {
         username.value="";
         password.value="";
        }
    </script>

  </head>

  <body onload="self.setTimeout('clearfields()', 500)">
    <form method="post">
      <input name="username" type="text" >
      <input name="password" type="password"> 
    </form>
  </body>

</html>


delarocha
 
Posts: 2
Joined: April 5th, 2006, 9:29 am
Location: Denver, CO
April 6th, 2006, 10:39 am

Post Posted April 6th, 2006, 10:39 am

That did the trick. Delaying the javascript is key here. Thanks so much for your help!
Word.

Return to Mozilla Development


Who is online

Users browsing this forum: No registered users and 1 guest