日期:2014-05-16  浏览次数:20357 次

CSS风格的变换
当点击一个checkbox时text框是一种风格,取消checkbox时文本框又是一种风格,请问该如何实现?

------解决方案--------------------
<link rel= "stylesheet " href= "a.css " id= "css ">
<input type=checkbox onclick= "GetCSS(this) ">
<script>
function GetCSS(o)
{
if(o.checked)
document.getElementById( "css ").href= "b.css "
else
document.getElementById( "css ").href= "a.css "
}
</script>

a.css
===========
body{
background:red
}

b.css
==========
body{
background:blue
}
------解决方案--------------------
<style>
.aa{background-color:red}
.bb{background-color:blue}
</style>
<input class= "aa " type= "checkbox " onclick= "(this.className== 'aa ')?this.className= 'bb ':this.className= 'aa '; ">
------解决方案--------------------
<script language= "javascrit ">
<!--
var cb=document.getElementById( "checkbox ")
if(cb.check)
document.getElementByTag( "text ").style.className=“样式一 ";
else
document.getElementByTag( "text ").style.className=“样式二 ";
-->
</script>