[Project_owners] password field

Neil neil at parkwaycc.co.uk
Fri Jul 1 11:45:35 EDT 2005


Eric Jung wrote:

>var wm =
>  Components.classes["@mozilla.org/appshell/window-mediator;1"].
>  getService(Components.interfaces.nsIWindowMediator);
>var recentWindow = wm.getMostRecentWindow("navigator:browser");
>var doc = recentWindow._content.document;
>  
>
Underscore prefixes are for link targets <a href="_top" ...> etc. Just 
use .content.

>var inputElements = doc.getElementsByTagName("input");
>for (var i=0; i<inputElements.length; i++) {
>  var type = inputElements[i].getAttribute("type");
>  if (type && type.toLowerCase() == "password")
>    if(inputElements[i].getAttribute("value") != null) dump("foo\n");
>  
>
getAttribute returns the original value. Just use .value - and you can 
do the same trick with .type which is always lower case. Try
if (inputElements[i].type == "password" && inputElements[i].value != 
inputElements[i].defaultValue)


More information about the Project_owners mailing list