怎么让它被选中的时候就不是蓝色 而是变成红色的?
<html>
<head>
<style type="text/css">
textarea{resize:none;border:1px solid blue;}
</style>
<script>
window.onload=function(){
var oTxt=document.getElementById("txt1")
if(oTxt.oninput==true)
{
oTxt.style.border=1px solid red;
};
};
</script>
</head>
<body>
<textarea id="txt1" cols="30" rows="10"></textarea>
</body>
</html>
第1个回答 2015-03-03
<html>
<head>
<style type="text/css">
textarea{resize:none;border:1px solid blue;}
</style>
<script>
window.onload=function(){
var oTxt=document.getElementById("txt1")
oTxt.onfocus=function()
{
oTxt.style.border="1px solid red";
};
oTxt.onblur=function()
{
oTxt.style.border="1px solid blue";
};
};
</script>
</head>
<body>
<textarea id="txt1" cols="30" rows="10"></textarea>
</body>
</html>追问
<head>
<style type="text/css">
textarea{resize:none;border:1px solid blue;}
</style>
<script>
window.onload=function(){
var oTxt=document.getElementById("txt1")
oTxt.onfocus=function()
{
oTxt.style.border="1px solid red";
};
oTxt.onblur=function()
{
oTxt.style.border="1px solid blue";
};
};
</script>
</head>
<body>
<textarea id="txt1" cols="30" rows="10"></textarea>
</body>
</html>追问
谢谢
本回答被提问者采纳