就是当Focus时使用另一种样式?比如背景变成别的颜色,当LoseFocus时恢复。
要求用两种方法实现,一种是 使用另外的Class一种是直接写BackGround-Color.
1<head>
2<style>
3.focus{background-color:#ffffff}
4.blur{background-color:#3366cc}
5</style>
6</head>
1<body>
2<input onblur="style.backgroundColor='#3366cc'" onfocus="style.backgroundColor=''"/>
3<input onblur="className='blur'" onfocus="className='focus'"/>
4</body>
---------------------------------------------------------------
1<input onblur="style.color='Blue'" onfocus="style.color='Red'"/>
---------------------------------------------------------------
1<input onblur="style.backgroundColor='Blue'" onfocus="style.backgroundColor='Red'"/>
1<html>
2<head>
3<title>Script Encoder Sample Page</title>
4<style>
5.input1{behavior:url("bg.htc")}
6</style>
7</head>
8<body>
9<input class="input1"/>
10</body>
11</html>
bg.htc//同一目录
1<public:component>
2<public:attach event="onfocus" onevent="fos()"></public:attach>
3<public:attach event="onblur" onevent="blu()"></public:attach>
4<script>
5function fos(){
6style.backgroundColor='#ffffff'
7}
8function blu(){
9style.backgroundColor='#3366cc'
10}
11</script>
12</public:component>