When the text box gets the focus, the background color is changed (you can reference: input, textarea {behavior: URL (/CSS/***. HTC) in the style sheet );})

Source: Internet
Author: User
<! --  
/* ===========================================/
* Behavior file bound to the style textbox

*
* Function:
* When the user's cursor is positioned in an input box,
* The input box displays the dynamic effects of different colors.

========================================== */
-->
< Public: attach event = " Onfocus " Onevent = " Dofocus () "/ >
< Public: attach event = " Onblur " Onevent = " Doblur () "/ >

< Script Language = " JScript " >
Function Dofocus ()
{
If (Element. tagname ! =   ' Input '   && Element. tagname ! =   ' Textarea ' )
Return   False ;
If (Element. tagname =   ' Input '   && (Element. Type =   " Submit "   | Element. Type =   " Button " ))
Return   False ;

If(!Element. readonly)
{
Element. style. backgroundcolor= '# E0ffff';
}
}

Function Doblur ()
{
If (Element. tagname ! =   ' Input '   && Element. tagname ! =   ' Textarea ' )
Return   False ;
If (Element. tagname =   ' Input '   && (Element. Type =   " Submit "   | Element. Type =   " Button " ))
Return   False ;

Element. style. backgroundcolor= '# Ffffff';
}

// Cookie content
Function Getcookieval (offset)
{
VaR Endstr = Document. Cookie. indexof ( " ; " , Offset );
If (Endstr =   - 1 )
Endstr = Document. Cookie. length;
Return Unescape (document. Cookie. substring (offset, endstr ));
}

// Obtains the value of a specified cookie.
Function Getcookie (name)
{
VaR ARG = Name +   " = " ;
VaR Alen = Arg. length;
VaR Clen = Document. Cookie. length;
VaR I =   0 ;
While (I < Clen)
{
VaR J = I + Alen;
If (Document. Cookie. substring (I, j) = Arg)
Return Getcookieval (j );
I = Document. Cookie. indexof ( "   " , I) +   1 ;
If (I =   0 ) Break ;
}
Return   Null ;
}

</SCRIPT>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.