S
sklett
I want to implement a simple form element focus script that will change the
color of a form element when it gets focus and revert back when it loses
focus.
I've got the code working (simple) but now I need to add it to ALL my form
controls and there are tons. Is there a way to override page rendering and
insert the javascript into the rendered page source?
For example, this is what I would like to add to my controls:
onfocus="hilightActiveElement(this);
So the whole control looks like:
<asp:TextBox ID="TextBox_PatientAddress2" runat="server" TabIndex="6"
Width="223px" onfocus="hilightActiveElement(this);" />
I'm using a function now so that as I tweak the look and feel I don't need
to update it too many places, but if I was going to inject it at render time
I would just use: onfocus="this.style.background = ''";
onblur="this.style.background = '';"
Any ideas welcome. Thanks!
Steve
color of a form element when it gets focus and revert back when it loses
focus.
I've got the code working (simple) but now I need to add it to ALL my form
controls and there are tons. Is there a way to override page rendering and
insert the javascript into the rendered page source?
For example, this is what I would like to add to my controls:
onfocus="hilightActiveElement(this);
So the whole control looks like:
<asp:TextBox ID="TextBox_PatientAddress2" runat="server" TabIndex="6"
Width="223px" onfocus="hilightActiveElement(this);" />
I'm using a function now so that as I tweak the look and feel I don't need
to update it too many places, but if I was going to inject it at render time
I would just use: onfocus="this.style.background = ''";
onblur="this.style.background = '';"
Any ideas welcome. Thanks!
Steve