这里只是一个使用CSS的骗子方式......
演示: http ://jsfiddle.net/gvee/6fRUd/
<div>
<input type="text" />
</div>
Run Code Online (Sandbox Code Playgroud)
div {
overflow: hidden;
background-color: blue;
}
div * {
position: relative;
z-index: 10;
}
div input[type=text]:focus {
background-color: red;
box-shadow: 0 0 10000px 10000px lime;
z-index: 5;
}
Run Code Online (Sandbox Code Playgroud)