IE 7 and password fields

Posted by John
on Thursday, 06 March 2008

Quick Note. Unlike Firefox, Internet Explorer handles password fields a little differently, blanking out whatever value you pass it within a 'value' tag.

So...

Will have a password box in Firefox starred out, but in IE it'll appear blank.

To get around this you can use Prototype to inject a value into the password field, so the user see's it as starred out.

$('mypass').value='**';

Note, if you're generating the form dynamically with...

var innerhtml='

Only fire your $('mypass') code after the form has been written to the page otherwise you won't be able to get a handle on it (most cases you won't ever have this problem).

Safari 2 escaped characters

Posted by John
on Wednesday, 05 March 2008

Note to self: safari doesn't seem to like escaped characters being injected into an object within the DOM, seems to break them up.

So,

myObj.innerHTML = '<a onclick=\"do();\">execute</a>';

Comes out as...

<a onclick="; do(); ";>execute</a>

Doesn't happen in Firefox 2, IE6/7 or Safari 3 but fails in Safari 2.0.4