[Project_owners] password field

Eric Jung grimholtz at yahoo.com
Fri Jul 1 13:25:38 EDT 2005


Wow, thanks. That works great. 

I didn't know about the attribute "defaultValue". Could you possibly
give an example when to use recentWindow._content? I know you wrote
it's for link targets, but do you mean only use it on windows that
were opened as a result of a clicked link with a "target" attribute?

Thanks,
Eric


--- Neil <neil at parkwaycc.co.uk> wrote:

> 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)
> _______________________________________________
> Project_owners mailing list
> Project_owners at mozdev.org
> http://mozdev.org/mailman/listinfo/project_owners
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


More information about the Project_owners mailing list